Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Logger

Indexable

[key: string]: any

Index

Constructors

  • new Logger(name?: string, defaultLevel?: Level, factory?: any): Logger
  • Parameters

    • Optional name: string
    • Optional defaultLevel: Level
    • Optional factory: any

    Returns Logger

Properties

config: Config

The logger configuration.

currentLevel: LevelNum

The current log level.

levels: typeof Levels

The log levels.

logBytes: number

The number of bytes of cached logs.

logs: string[]

The cached logs.

name: string

The logger name.

onLog?: ((data: { level: string; logs: any[]; time: string }) => void)

Type declaration

    • (data: { level: string; logs: any[]; time: string }): void
    • The logs callback function.

      Parameters

      • data: { level: string; logs: any[]; time: string }
        • level: string

          The log level.

        • logs: any[]

          The log content.

        • time: string

          The time when logs are printed.

      Returns void

storageLogLevelKey: string

The log registration key in local storage.

Methods

  • disableAll(persist?: boolean): void
  • Disables the output of all levels of logs.

    Parameters

    • Optional persist: boolean

    Returns void

  • download(): void
  • Downloads logs.

    Returns void

  • enableAll(persist?: boolean): void
  • Enables the output of all levels of logs.

    Parameters

    • Optional persist: boolean

    Returns void

  • Gets the current log level.

    Returns LevelNum

  • getLogs(): string[]
  • Gets cached logs.

    Returns string[]

  • setConfig(config: Config): void
  • set Logger config.

    Parameters

    Returns void

  • setLevel(level: Level, persist: boolean, name: string): void
  • Sets the log level. The value range is 0-5.

    Parameters

    • level: Level
    • persist: boolean
    • name: string

    Returns void

Generated using TypeDoc