{"version":3,"file":"log-base.cjs","names":[],"sources":["../../../src/common/log/log-base.ts"],"sourcesContent":["export type LogLevel = number\n\nexport const LogLevelAll = -1\nexport const LogLevelDebug = 0\nexport const LogLevelInfo = 1\nexport const LogLevelWarn = 2\nexport const LogLevelError = 3\nexport const LogLevelFatal = 4\nexport const LogLevelOff = 9007199254740991 // `Infinity` ===  `1 / 0`, but bad for sideEffects, therefore `Math.pow(2, 53) - 1`\n\nexport const LogLevelAlias: Record<string, LogLevel> = {\n  '*': LogLevelAll,\n  'a': LogLevelAll,\n  'all': LogLevelAll,\n  'd': LogLevelDebug,\n  'dbg': LogLevelDebug,\n  'debug': LogLevelDebug,\n  'i': LogLevelInfo,\n  'inf': LogLevelInfo,\n  'info': LogLevelInfo,\n  'w': LogLevelWarn,\n  'warn': LogLevelWarn,\n  'warning': LogLevelWarn,\n  'e': LogLevelError,\n  'err': LogLevelError,\n  'error': LogLevelError,\n  'fatal': LogLevelFatal,\n  'off': LogLevelOff,\n  '-': LogLevelOff,\n}\n\nexport type LogLevelAliasKey = keyof typeof LogLevelAlias\nexport type LogLevelAliasType = number | boolean | LogLevelAliasKey\n\nexport interface LogMessage {\n  level: LogLevel\n  name: string\n  messages: any[]\n  line?: number\n  file?: string\n  timestamp?: number\n}\n\nexport type LogMessageCompact = [\n  timestamp: number,\n  level: LogLevel,\n  name: string,\n  ...messages: any[],\n]\n\nexport type LogHandler = (msg: LogMessage) => void\n\nexport interface LoggerInterface {\n  (...messages: any[]): void\n\n  /** @deprecated use .level = LogLevel.off or LogLevel.all */\n  active: boolean\n\n  level: LogLevel\n\n  generic: (level: LogLevel, ...messages: any[]) => void\n\n  debug: (...messages: any[]) => void\n\n  info: (...messages: any[]) => void\n\n  warn: (...messages: any[]) => void\n\n  error: (...messages: any[]) => void\n\n  /**\n   * Throws if condition is not truthy.\n   *\n   * **Attention!**  Due to a bug in typescript you will need to explicitly set the `LoggerInterface` type in\n   * order to have the assertions having an effect on unreachable code. Example:\n   *\n   * ```\n   * const log: LoggerInterface = Logger('xxx')\n   * ```\n   *\n   * Bug https://github.com/microsoft/TypeScript/issues/50363#issuecomment-1219811447\n   */\n  assert: (condition: unknown, ...messages: any[]) => asserts condition\n\n  /**\n   * Always throws.\n   *\n   * **Attention!** Due to a bug in typescript you will need to explicitly set the `LoggerInterface` type in\n   * order to have the assertions having an effect on unreachable code. Example:\n   *\n   * ```\n   * const log: LoggerInterface = Logger('xxx')\n   * ```\n   *\n   * Bug https://github.com/microsoft/TypeScript/issues/50363#issuecomment-1219811447\n   */\n  fatal: (...messages: any[]) => never\n\n  extend: (prefix: string) => LoggerInterface\n\n  factory?: LoggerContextInterface\n\n  label: string\n}\n\nexport interface LoggerContextInterface {\n  (name?: string, level?: LogLevelAliasType): LoggerInterface\n\n  registerHandler: (handler: LogHandler) => void\n\n  setFilter: (namespaces: string) => void\n\n  setHandlers: (handlers?: (LogHandler | undefined | null)[]) => void\n\n  setLock: (lock: boolean) => void\n\n  /** When true emits a short log message for each Logger when being set up first time. */\n  setDebug: (debug: boolean) => void\n\n  setLogLevel: (level?: LogLevel) => void\n\n  setFactory: (factory: (name?: string) => LoggerInterface) => void\n}\n\nexport interface LogHandlerOptions {\n  level?: LogLevel\n  filter?: string\n  colors?: boolean\n  levelHelper?: boolean\n  nameBrackets?: boolean\n  padding?: number\n  fill?: number\n  stack?: boolean | number\n  time?: boolean\n  pretty?: boolean\n}\n"],"mappings":";;;AAEA,MAAa,cAAc;AAC3B,MAAa,gBAAgB;AAC7B,MAAa,eAAe;AAC5B,MAAa,eAAe;AAC5B,MAAa,gBAAgB;AAC7B,MAAa,gBAAgB;AAC7B,MAAa,cAAc;AAE3B,MAAa,gBAA0C;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,OAAO;CACP,KAAK;CACN"}