🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@koakh/typescript-simple-logger

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@koakh/typescript-simple-logger

a simple logger implementation, without dependencies...

latest
npmnpm
Version
1.1.19
Version published
Maintainers
1
Created
Source

README

a simple logger implementation, without dependencies...

  • GitHub
  • NPM

Usage

use like that

add to .env

# logLevel
LOG_LEVEL=DEBUG,INFO,WARN,ERROR
  • c3edu.online:/home/c3/c3-lexactivator/lerna-monorepo/packages/cryptlex-lexactivator-api/src/config/constants.ts
  • c3edu.online:/home/c3/c3-system-core/src/app/constants.ts
// env constants
export const LOG_LEVEL: LogLevel = (process.env.LOG_LEVEL) ? getEnumKeyFromEnumValue(LogLevel, process.env.LOG_LEVEL) : `${LogLevel.INFO},${LogLevel.WARN},${LogLevel.ERROR}`;
  • c3edu.online:/home/c3/c3-lexactivator/lerna-monorepo/packages/cryptlex-lexactivator-api/src/app.ts
import { Logger, LogLevel } from '@koakh/typescript-simple-logger';

export class App {
  // static
  public static log(logLevel: LogLevel, message: string | object) {
    App.logger.log(logLevel, message);
  }
  
  ...

  // private
  private static logger: Logger = new Logger(
    // require to pass a callback function, this way we can change the log level at runtime
    () => { return App.getState()?.app?.logLevel || LOG_LEVEL }
    , LOG_FILE_PATH, LOG_USE_COLOR
  );
  
  ...

  // example of usage
  constructor() {
    App.log(LogLevel.INFO, 'some message');
  }
}

export const getStateLogLevel = (): LogLevel => {
  return App.getState()?.app?.logLevel || LOG_LEVEL;
}

// init App
export default new App();

Keywords

logger

FAQs

Package last updated on 04 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts