-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathconstants.ts
53 lines (49 loc) · 1.12 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* The indent level for JSON logs.
*
* By default Logger will use the `LogJsonIndent.COMPACT` indent level, which
* produces logs on a single line. This is the most efficient option for
* CloudWatch Logs.
*
* When enabling the `POWERTOOLS_DEV` environment variable, Logger will use the
* `LogJsonIndent.PRETTY` indent level, which indents the JSON logs for easier
* reading.
*/
const LogJsonIndent = {
PRETTY: 4,
COMPACT: 0,
} as const;
const LogLevel = {
TRACE: 'TRACE',
DEBUG: 'DEBUG',
INFO: 'INFO',
WARN: 'WARN',
ERROR: 'ERROR',
SILENT: 'SILENT',
CRITICAL: 'CRITICAL',
} as const;
/**
* Numeric values for each log level.
*/
const LogLevelThreshold = {
TRACE: 6,
DEBUG: 8,
INFO: 12,
WARN: 16,
ERROR: 20,
CRITICAL: 24,
SILENT: 28,
} as const;
/**
* Reserved keys that are included in every log item when using the default log formatter.
*
* These keys are reserved and cannot be overwritten by custom log attributes.
*/
const ReservedKeys = [
'level',
'message',
'sampling_rate',
'service',
'timestamp',
];
export { LogJsonIndent, LogLevel, LogLevelThreshold, ReservedKeys };