Skip to content

Commit

Permalink
Revert "Added String Templating #39"
Browse files Browse the repository at this point in the history
This reverts commit 39d9cf3.
  • Loading branch information
TanmoySG authored Jun 17, 2022
1 parent e45703e commit 2bd2b8c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 29 deletions.
4 changes: 2 additions & 2 deletions libraries/js/examples/index.js
Original file line number Diff line number Diff line change
@@ -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" } }))
console.log(logg.getParams())
13 changes: 2 additions & 11 deletions libraries/js/logsmith/logsmith.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
}
}
17 changes: 3 additions & 14 deletions libraries/js/logsmith/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions libraries/js/logsmith/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"author": "Tanmoy Sen Gupta",
"license": "ISC",
"dependencies": {
"chalk": "^5.0.1",
"string-template": "^1.0.0"
"chalk": "^5.0.1"
}
}

0 comments on commit 2bd2b8c

Please sign in to comment.