Skip to content

Commit

Permalink
Added disable logger method and log minlevel
Browse files Browse the repository at this point in the history
  • Loading branch information
chamorin committed Jun 7, 2023
1 parent ad6516a commit e7db49b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Logger, type ILogObj } from "tslog";
class SinkLogger extends Logger<ILogObj> {
constructor() {
super();
this.settings.type = "hidden";
this.disable();
}

public setName(name: string) {
Expand All @@ -12,6 +12,12 @@ class SinkLogger extends Logger<ILogObj> {

public enable() {
this.settings.type = "pretty";
this.settings.minLevel = 0;
}

public disable() {
this.settings.type = "hidden";
this.settings.minLevel = 5;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
DEFAULT_VERBOSE,
DEFAULT_PROMETHEUS_ADDRESS,
DEFAULT_PROMETHEUS_PORT,
DEFAULT_METRICS_DISABLED as DEFAULT_METRICS_DISABLED,
DEFAULT_METRICS_DISABLED,
type RunOptions,
} from "./cli.js";
import { logger } from "./logger.js";
Expand Down

0 comments on commit e7db49b

Please sign in to comment.