From 7852fafa15cbb6f9bd816867672c2cbd16cd866e Mon Sep 17 00:00:00 2001 From: pq Date: Wed, 1 Jan 2025 17:11:32 -0600 Subject: [PATCH] Add quickielog/index.js --- quickielog/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 quickielog/index.js diff --git a/quickielog/index.js b/quickielog/index.js new file mode 100644 index 0000000..073e59d --- /dev/null +++ b/quickielog/index.js @@ -0,0 +1,16 @@ +"use strict"; +class Logger { + constructor(app_name, use_json = false) { + this.app_name = app_name + this.use_json = use_json + } +} +function log(logger, level, msg) { + if (logger.use_json) { + console.log(`{\"app\": \"${logger.app_name}\",\"level\": \"${level}\",\"message\": \"${msg}\"}`) + } else { + console.log(`${logger.app_name} [${level}]: ${msg}`) + } +} +exports.log = log; +exports.Logger = Logger; \ No newline at end of file