UNPKG

loggers-factory

Version:

Javascript package that makes the use of loggers a breath.

55 lines (53 loc) 1.63 kB
const { join, dirname } = require("path"); const get_default_console_format = require("./get_default_console_format.js"); const get_default_log_format = require("./get_default_log_format.js"); module.exports = { source: "main", // main path (not used but reminds that it can be provided and in this case, // we have to change the transports logs paths) logs_path: join(dirname(require.main.filename), "logs"), level_design: { levels: { error: 0, warn: 1, info: 2, debug: 3, silly: 4 }, colors: { error: "italic bold red", warn: "italic bold magenta", info: "italic bold green", debug: "italic bold blue", silly: "italic bold yellow" } }, transport: { console: { level: process.env.LOG_CONSOLE_LEVEL || "info", format: get_default_console_format("main") // to change if another source is given }, logs: { combined: { name: "combined", level: process.env.LOG_COMBINED_LEVEL || "silly", logs_path: join(dirname(require.main.filename), "logs"), // to change if another path is given format: get_default_log_format("main"), // to change if another source is given date_pattern: "DD-MM-YYYY:HH", max_size: undefined, max_files: "14d", on_limit: undefined }, errors: { name: "errors", level: process.env.LOG_ERRORS_LEVEL || "error", logs_path: join(dirname(require.main.filename), "logs"), // to change if another path is given format: get_default_log_format("main"), // to change if another source is given date_pattern: "DD-MM-YYYY", max_size: undefined, max_files: "14d", on_limit: undefined } } } };