simple-leveled-log-methods
Version:
a simple and opinionated logging library. plays well with aws lambda + cloudwatch.
42 lines • 2.08 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.SupportedEnvironment = exports.isOfLogLevel = exports.LogLevel = void 0;
const type_fns_1 = require("type-fns");
/**
* define the supported log levels
*/
var LogLevel;
(function (LogLevel) {
LogLevel["ERROR"] = "error";
LogLevel["WARN"] = "warn";
LogLevel["INFO"] = "info";
LogLevel["DEBUG"] = "debug";
})(LogLevel || (exports.LogLevel = LogLevel = {}));
exports.isOfLogLevel = (0, type_fns_1.createIsOfEnum)(LogLevel);
/**
* define specifically supported environments
*/
var SupportedEnvironment;
(function (SupportedEnvironment) {
/**
* the local environment balances information -vs- oversharing
* - metadata is stringified to not cause too much visual "noise" in the console
* - log level should default to being conservatively balanced, to reduce noise in the console
* - especially when considering the ease of retrying requests with more permissive log-level specified
*/
SupportedEnvironment["LOCAL"] = "LOCAL";
/**
* the aws environment has a few extra considerations for logging
* - metadata should not be json-stringified, and should be simply nested instead for cloudwatch insights parsing
* - log level should default to be more permissive, as cloudwatch costs are low enough to be worth the increased visibility in most cases
*/
SupportedEnvironment["AWS_LAMBDA"] = "AWS_LAMBDA";
/**
* the web browser environment allows us to focus on accessibility of information
* - the metadata should not be json-stringified. instead, it should be simply nested for devtools console accessibility
* - log level should default to being conservatively balanced, to reduce noise in the console
* - especially when considering the ease of retrying requests with more permissive log-level specified
*/
SupportedEnvironment["WEB_BROWSER"] = "WEB_BROWSER";
})(SupportedEnvironment || (exports.SupportedEnvironment = SupportedEnvironment = {}));
//# sourceMappingURL=constants.js.map
;