@zelgadis87/utils-core 4.11.1 → 4.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@zelgadis87/utils-core",
4
- "version": "4.11.1",
4
+ "version": "4.11.2",
5
5
  "author": "Zelgadis87",
6
6
  "license": "ISC",
7
7
  "private": false,
package/src/Logger.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import TimeInstant from "./time/TimeInstant";
2
- import { noop } from "./utils/_index.js";
2
+ import { noop, padRight } from "./utils/_index.js";
3
3
 
4
4
  const LEVELS = [ "log", "debug", "info", "warn", "error" ] as const;
5
5
  type TLogLevel = keyof Console & typeof LEVELS[ number ]
@@ -34,11 +34,9 @@ export class Logger {
34
34
  public get error() { return this.logWrap( 'error' ); }
35
35
 
36
36
  private logWrap( methodName: TLogLevel ) {
37
- if ( !this.console[ methodName ] )
38
- throw new Error( 'Invalid method name: ' + methodName );
39
37
  if ( !this.enabled || !this.console || LEVELS.indexOf( methodName ) < this.minLevel )
40
38
  return noop;
41
- return this.console[ methodName ].bind( this.console, timestamp(), methodName.toUpperCase(), this.name );
39
+ return this.console[ methodName ].bind( this.console, timestamp(), padRight( methodName.toUpperCase(), 5, ' ' ), this.name );
42
40
  }
43
41
 
44
42
  }