Skip to content

Commit

Permalink
Add DefaultLoggerWithTimestamp
Browse files Browse the repository at this point in the history
  withTimestamp() {
    return this.transform((log) => (...args: unknown[]) => {
      return log(new Date().toISOString(), ...args);
    });
  }DefaultLoggerWithTimestamp
  • Loading branch information
nktpro committed Dec 1, 2023
1 parent c7ca786 commit 78d7411
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
40 changes: 20 additions & 20 deletions flake.lock

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

3 changes: 3 additions & 0 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ export class Logger {
}

export const DefaultLogger = new Logger(console.error.bind(console), levelValue);
export const DefaultLoggerWithTimestamp = DefaultLogger.transform((log) => (...args: unknown[]) => {
return log(new Date().toISOString(), ...args);
});

0 comments on commit 78d7411

Please sign in to comment.