tslog icon indicating copy to clipboard operation
tslog copied to clipboard

Feature Request: please bring back log level name constructor where minLevel takes a string

Open a-r-d opened this issue 2 years ago • 0 comments

Description / Use Case for a Feature

I appears that this is gone from the new code. In the old code you could construct the logger with a string based level instead of a numeric value.

/**
 * All possible log levels
 * @public
 */
export interface ILogLevel {
  0: "silly";
  1: "trace";
  2: "debug";
  3: "info";
  4: "warn";
  5: "error";
  6: "fatal";
}


/**
 * Constructor: logger settings
 * all values are optional and will be pre-filled with default values
 * @public
 */
export interface ISettingsParam {
...

  /** Minimum output log level (e.g. debug), default: "silly" */
  minLevel?: TLogLevelName;

...
}

I believe this is a worse developer experience as a consumer because now in my environment file I can't simply set the log level to be "info" or "debug" or "warn". I have to set it to some ambiguous number.

e.g. - I have to set it to be "3" using the newer constructor. What does "3" mean? Nobody on my team knows unless they look it up in this repo.

a-r-d avatar Aug 06 '23 16:08 a-r-d