@aws-lambda-powertools/logger
Version:
The logging package for the Powertools for AWS Lambda (TypeScript) library
61 lines (60 loc) • 1.68 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.UncaughtErrorLogMessage = exports.ReservedKeys = exports.LogLevelThreshold = exports.LogLevel = exports.LogJsonIndent = void 0;
/**
* 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,
};
exports.LogJsonIndent = LogJsonIndent;
const LogLevel = {
TRACE: 'TRACE',
DEBUG: 'DEBUG',
INFO: 'INFO',
WARN: 'WARN',
ERROR: 'ERROR',
SILENT: 'SILENT',
CRITICAL: 'CRITICAL',
};
exports.LogLevel = LogLevel;
/**
* Numeric values for each log level.
*/
const LogLevelThreshold = {
TRACE: 6,
DEBUG: 8,
INFO: 12,
WARN: 16,
ERROR: 20,
CRITICAL: 24,
SILENT: 28,
};
exports.LogLevelThreshold = LogLevelThreshold;
/**
* 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',
];
exports.ReservedKeys = ReservedKeys;
/**
* Message logged when an uncaught error occurs in a Lambda function.
*/
const UncaughtErrorLogMessage = 'Uncaught error detected, flushing log buffer before exit';
exports.UncaughtErrorLogMessage = UncaughtErrorLogMessage;
;