declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
25 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.log = exports.ActiveLogLevel = void 0;
const simple_log_methods_1 = require("simple-log-methods");
/*
purpose of logger:
- distinguish different levels of logs
- specifies importance
- allows filtering which to send
- defines standard format of log messages
- sends to standard transport
*/
/*
define the minimal log level
*/
const defaultLogLevel = process.env.AWS_LAMBDA_FUNCTION_NAME
? simple_log_methods_1.LogLevel.DEBUG // if AWS_LAMBA_FUNCTION_NAME is set, then we're in lambda env and should transport all messages to console
: simple_log_methods_1.LogLevel.INFO; // otherwise, we're running locally and should only show info and above
const minimalLogLevel = process.env.LogLevel || defaultLogLevel; // use the log level specified or fallback to default if none specified
exports.ActiveLogLevel = minimalLogLevel;
/*
define the log methods
*/
exports.log = (0, simple_log_methods_1.generateLogMethods)({ minimalLogLevel });
//# sourceMappingURL=logger.js.map