Skip to content

Commit

Permalink
Added File Logging Support #39
Browse files Browse the repository at this point in the history
  • Loading branch information
TanmoySG authored May 19, 2022
1 parent f2cc4bf commit e00ed14
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion libraries/js/logsmith/lib/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ export const LogLevels = {
export const LogFormats = {
JSON: "json",
STATEMENT: "statement"
}
}

export var logs = []
14 changes: 13 additions & 1 deletion libraries/js/logsmith/logsmith.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class Logsmith {
const configs = readConfigFile("json", filepath)
this.env = configs.env || "default"
this.logfile = configs.logfile || null
this.consoleOnly = configs.consoleOnly
this.consoleOnly = configs.consoleOnly
this.logFormat = Object.values(LogFormats).includes(configs.logFormat) ? configs.logFormat : LogFormats.JSON
this.logStatementPattern = configs.logStatementPattern || DefaultLogStatementPattern
this.compiledLogPattern = compile(this.logStatementPattern)
Expand All @@ -35,6 +35,8 @@ export default class Logsmith {
this.env,
this.compiledLogPattern,
this.logFormat,
this.consoleOnly,
this.logfile,
log
)
}
Expand All @@ -45,6 +47,8 @@ export default class Logsmith {
this.env,
this.compiledLogPattern,
this.logFormat,
this.consoleOnly,
this.logfile,
log
)
}
Expand All @@ -56,6 +60,8 @@ export default class Logsmith {
this.env,
this.compiledLogPattern,
this.logFormat,
this.consoleOnly,
this.logfile,
log
)
}
Expand All @@ -66,6 +72,8 @@ export default class Logsmith {
this.env,
this.compiledLogPattern,
this.logFormat,
this.consoleOnly,
this.logfile,
log
)
}
Expand All @@ -76,6 +84,8 @@ export default class Logsmith {
this.env,
this.compiledLogPattern,
this.logFormat,
this.consoleOnly,
this.logfile,
log
)
}
Expand All @@ -87,6 +97,8 @@ export default class Logsmith {
this.env,
this.compiledLogPattern,
this.logFormat,
this.consoleOnly,
this.logfile,
log
)
}
Expand Down

0 comments on commit e00ed14

Please sign in to comment.