Skip to content

Commit

Permalink
fix: Wrapped props set in try catch to avoid any errors that may happ…
Browse files Browse the repository at this point in the history
…en because of undefined parameters
  • Loading branch information
konotorii committed Aug 11, 2024
1 parent 312f67f commit 6579b82
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/utility/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@ class Logger {
log_file: string

constructor(process: string, props?: LoggerProps) {
this.props = {
outputFile: props.outputFile ? props.outputFile : undefined,
filePath: props.filePath ? props.filePath : "",
outputJson: props.outputJson ? props.outputJson : undefined,
try {
this.props = {
outputFile: props.outputFile ? props.outputFile : false,
filePath: props.filePath ? props.filePath : "",
outputJson: props.outputJson ? props.outputJson : false,
}
} catch (e) {
this.props = {
outputFile: false,
filePath: "",
outputJson: false,
}
}

this.process = process
this.log_file = `${DateTime.now().toFormat("HH mm ss dd LL yyyy")}.log`;
}
Expand Down

0 comments on commit 6579b82

Please sign in to comment.