@ketch-sdk/ketch-logging
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

ketch-logging

Basic logging capabilities.

Logger

const prefix: string = ''
const level: string | LogLevel = getLogLevel() // or LogLevel.WARN or 'warn' (default level)
const logger: Logger = getLogger(prefix, level)

Returns a new Logger, which provides the following interface:

export interface Logger {
  trace(...data: any[]): void
  debug(...data: any[]): void
  info(...data: any[]): void
  log(...data: any[]): void
  warn(...data: any[]): void
  error(...data: any[]): void
}

getLogLevel

const input: string = window.location.search
const prefix = 'swb_'
const logLevel: LogLevel = getLogLevel(input, prefix)

Determines the log level from the given input (defaults to the querystring). The prefix which defaults to swb_ is added to log to locate the parameter.

/@ketch-sdk/ketch-logging/

    Package Sidebar

    Install

    npm i @ketch-sdk/ketch-logging

    Weekly Downloads

    122

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    15.8 kB

    Total Files

    7

    Last publish

    Collaborators

    • sethswitchbit
    • ketch-ci