Skip to content

Commit

Permalink
feat: add file flags to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
andr-ll committed Nov 6, 2023
1 parent 1a3d506 commit 6c20a4f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuti",
"version": "3.0.0",
"version": "3.0.1",
"author": "Andrii Lytovchenko <andr.lyt.dev@gmail.com>",
"license": "MIT",
"description": "A collection of commonly used utils for Node.js.",
Expand Down
4 changes: 2 additions & 2 deletions src/logger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Logger {
private writers: Writer[] = [];

constructor(options: LoggerOptions = {}) {
const { filePath, stdoutEnable = true } = options;
const { filePath, stdoutEnable = true, flags } = options;

if (stdoutEnable === false && filePath == null) {
throw new Error('At least one output has to be specified!');
Expand All @@ -25,7 +25,7 @@ export class Logger {
}

if (typeof filePath === 'string') {
const stream = fs.createWriteStream(filePath);
const stream = fs.createWriteStream(filePath, { flags });
this.createWriter(stream.write.bind(stream), true);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/logger/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export interface Context {
export interface LoggerOptions {
stdoutEnable?: boolean;
filePath?: string;
flags?: string;
}

0 comments on commit 6c20a4f

Please sign in to comment.