declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
25 lines • 1.13 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.log = exports.ACTIVE_LOG_LEVEL = void 0;
const simple_leveled_log_methods_1 = require("simple-leveled-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_leveled_log_methods_1.LOG_LEVEL.DEBUG // if AWS_LAMBA_FUNCTION_NAME is set, then we're in lambda env and should transport all messages to console
: simple_leveled_log_methods_1.LOG_LEVEL.INFO; // otherwise, we're running locally and should only show info and above
const minimalLogLevel = process.env.LOG_LEVEL || defaultLogLevel; // use the log level specified or fallback to default if none specified
exports.ACTIVE_LOG_LEVEL = minimalLogLevel;
/*
define the log methods
*/
exports.log = (0, simple_leveled_log_methods_1.generateLogMethods)({ minimalLogLevel });
//# sourceMappingURL=logger.js.map
;