Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @midwayjs/logger

References

DelegateLoggerOptions

DelegateLoggerOptions:

DelegateTransport

DelegateTransport:

DelegateTransportOptions

DelegateTransportOptions:

EmptyLogger

EmptyLogger:

EmptyTransport

EmptyTransport:

GeneralDailyRotateFileTransportOptions

GeneralDailyRotateFileTransportOptions:

ILogger

ILogger:

IMidwayLogger

IMidwayLogger:

LoggerCustomInfoHandler

LoggerCustomInfoHandler:

LoggerLevel

LoggerLevel:

LoggerOptions

LoggerOptions:

MidwayBaseLogger

MidwayBaseLogger:

MidwayContextLogger

MidwayContextLogger:

MidwayDelegateLogger

MidwayDelegateLogger:

MidwayLoggerContainer

MidwayLoggerContainer:

MidwayTransformableInfo

MidwayTransformableInfo:

displayCommonMessage

displayCommonMessage:

displayLabels

displayLabels:

format

format:

transports

transports:

Type aliases

ContainerCoverMethodName

ContainerCoverMethodName: "disableConsole" | "disableFile" | "disableError" | "updateLevel" | "updateConsoleLevel" | "updateFileLevel"

LoggerCustomInfoHandler

LoggerCustomInfoHandler: function

LoggerLevel

LoggerLevel: "all" | "silly" | "debug" | "info" | "warn" | "error" | "none"

NewLogger

NewLogger: Omit<Logger, "log" | "add" | "close" | "remove" | "write" | "info" | "warn" | "debug" | "error" | "verbose" | "silly">

Variables

Const DATE_FORMAT

DATE_FORMAT: "YYYYMMDDHHmm" = "YYYYMMDDHHmm"

Const EmptyLogger

EmptyLogger: object & NewLogger = createLogger().constructor as unknown as {new (options?: LoggerOptions): IMidwayLogger &NewLogger & {log(...args): any;};} & NewLogger

Const ORIGIN_ARGS

ORIGIN_ARGS: unique symbol = Symbol('origin_args')

Const ORIGIN_ERROR

ORIGIN_ERROR: unique symbol = Symbol('origin_error')

Transport

Transport: TransportStream

TransportStream

TransportStream: TransportStream

TransportStream

TransportStream: TransportStream

Const debug

debug: DebugLogger = debuglog('midway-logger')

Const displayCommonMessage

displayCommonMessage: FormatWrap = format((info,opts: {defaultLabel?: string;defaultMeta?: Record<string, unknown>;target?: IMidwayLogger;}) => {if (!info.pid) {info.pid = process.pid;}if (info[ORIGIN_ERROR as any]) {info.originError = info[ORIGIN_ERROR as any];}if (info[ORIGIN_ARGS as any]) {info.originArgs = info[ORIGIN_ARGS as any];}if (!info.ignoreFormat) {info.ignoreFormat = false;}if (!info.ctx) {info.ctx = null;}if (!info.LEVEL) {info.LEVEL = info.level.toUpperCase();}if (!info.defaultLabel) {info.defaultLabel =opts.defaultLabel || opts.target?.getDefaultLabel() || '';}return Object.assign(info,opts.defaultMeta || opts.target?.getDefaultMeta() || {});})

Const displayLabels

displayLabels: FormatWrap = format((info, opts) => {opts.labelSplit = opts.labelSplit || ':';info.labelText = joinLoggerLabel(opts.labelSplit,info.defaultLabel,...[].concat(info.label));return info;})

Const isWindows

isWindows: boolean = os.platform() === 'win32'

Const loggers

loggers: MidwayLoggerContainer = new MidwayLoggerContainer()

Const staticFrequency

staticFrequency: string[] = ['daily', 'test', 's', 'm', 'h', 'custom']

Functions

BubbleEvents

  • BubbleEvents(emitter: any, proxy: any): void

Const clearAllLoggers

  • clearAllLoggers(): void

Const createConsoleLogger

createCurrentSymLink

  • createCurrentSymLink(logfile: any, name: any): void

Const createFileLogger

Const createLogger

debounce

  • debounce(func: function, wait: number, immediate?: any): any

getMaxSize

  • getMaxSize(size: any): string

isPlainObject

  • isPlainObject(value: any): boolean

isValidDirName

  • isValidDirName(dirname: any): boolean

isValidFileName

  • isValidFileName(filename: any): boolean

joinLoggerLabel

  • joinLoggerLabel(labelSplit: any, ...labels: any[]): string

Const mkDirForFile

  • mkDirForFile(pathWithFile: any): void

Const noop

  • noop(): void

removeFile

  • removeFile(file: any): void

throwIf

  • throwIf(options: any, ...args: any[]): void

Object literals

Const loggerDefaults

loggerDefaults: object

colorize

colorize: boolean = false

depth

depth: null = null

eol

eol: string = os.EOL

json

json: boolean = false

label

label: null = null

logstash

logstash: null = null

prettyPrint

prettyPrint: boolean = false

showLevel

showLevel: boolean = true

stringify

stringify: boolean = false

timestamp

  • timestamp(): string

Const midwayLogLevels

midwayLogLevels: object

all

all: number = 7

debug

debug: number = 5

error

error: number = 1

info

info: number = 3

none

none: number = 0

silly

silly: number = 6

verbose

verbose: number = 4

warn

warn: number = 2

Const statusMapping

statusMapping: object

数组结构为获取当前的状态值 + 恢复状态值的方法

disableConsole

disableConsole: string[] = ['isEnableConsole', 'enableConsole']

disableError

disableError: string[] = ['isEnableError', 'enableError']

disableFile

disableFile: string[] = ['isEnableFile', 'enableFile']

updateConsoleLevel

updateConsoleLevel: string[] = ['getConsoleLevel', 'updateConsoleLevel']

updateFileLevel

updateFileLevel: string[] = ['getFileLevel', 'updateFileLevel']

updateLevel

updateLevel: string[] = ['getLevel', 'updateLevel']

Generated using TypeDoc