From 2bd2b8c62a7f1296e8e8a7e495b4b7b91a4c0d8d Mon Sep 17 00:00:00 2001 From: Tanmoy Sen Gupta Date: Fri, 17 Jun 2022 19:14:56 +0530 Subject: [PATCH] Revert "Added String Templating #39" This reverts commit 39d9cf342ecaf8c39a73ed844ffe034c620068a8. --- libraries/js/examples/index.js | 4 ++-- libraries/js/logsmith/logsmith.js | 13 ++----------- libraries/js/logsmith/package-lock.json | 17 +++-------------- libraries/js/logsmith/package.json | 3 +-- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/libraries/js/examples/index.js b/libraries/js/examples/index.js index 9e3df12..966ea45 100644 --- a/libraries/js/examples/index.js +++ b/libraries/js/examples/index.js @@ -1,4 +1,4 @@ -import Logsmith from "../logsmith/logsmith.js"; +import Logsmith from "logsmith"; const logg = new Logsmith({}) -console.log(logg.log({ level: "INFO", body: { col1: "val1", col2: "val2" } })) \ No newline at end of file +console.log(logg.getParams()) \ No newline at end of file diff --git a/libraries/js/logsmith/logsmith.js b/libraries/js/logsmith/logsmith.js index a05796d..3e7b23c 100644 --- a/libraries/js/logsmith/logsmith.js +++ b/libraries/js/logsmith/logsmith.js @@ -1,10 +1,7 @@ import chalk from 'chalk'; -import format from 'string-template'; // const LISTENER -const defaultLogPrintPattern = "[{level}] {body}" - const logLevels = { WARN: chalk.yellow, INFO: chalk.blue, @@ -20,19 +17,13 @@ const logLevels = { // console.log(logLevels.FAILURE("FAILURE")) export default class Logsmith { - constructor(options, statement) { + constructor(options) { this.env = options.env || "default" this.logfile = options.logfile || null this.console_only = options.console_only || true - this.logPrintPattern = statement || defaultLogPrintPattern } getParams() { - - } - - log(logbody) { - const logStatement = format(this.logPrintPattern, { level: logbody.level, body: JSON.stringify(logbody.body, null) }) - return logLevels.INFO(logStatement); + return this.env } } \ No newline at end of file diff --git a/libraries/js/logsmith/package-lock.json b/libraries/js/logsmith/package-lock.json index 4634fe6..8e4ef10 100644 --- a/libraries/js/logsmith/package-lock.json +++ b/libraries/js/logsmith/package-lock.json @@ -1,16 +1,15 @@ { - "name": "logsmith", + "name": "logsmith.js", "version": "0.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "logsmith", + "name": "logsmith.js", "version": "0.0.1", "license": "ISC", "dependencies": { - "chalk": "^5.0.1", - "string-template": "^1.0.0" + "chalk": "^5.0.1" } }, "node_modules/chalk": { @@ -23,11 +22,6 @@ "funding": { "url": "https://github.com/chalk/chalk?sponsor=1" } - }, - "node_modules/string-template": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz", - "integrity": "sha1-np8iM9wA8hhxjsN5oopWc+zKi5Y=" } }, "dependencies": { @@ -35,11 +29,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==" - }, - "string-template": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz", - "integrity": "sha1-np8iM9wA8hhxjsN5oopWc+zKi5Y=" } } } diff --git a/libraries/js/logsmith/package.json b/libraries/js/logsmith/package.json index 044fd16..692eb6b 100644 --- a/libraries/js/logsmith/package.json +++ b/libraries/js/logsmith/package.json @@ -15,7 +15,6 @@ "author": "Tanmoy Sen Gupta", "license": "ISC", "dependencies": { - "chalk": "^5.0.1", - "string-template": "^1.0.0" + "chalk": "^5.0.1" } }