Skip to main content

Class: Logger

@sapphire/plugin-logger.Logger

The logger class.

since 1.0.0

Hierarchy

  • BuiltinLogger

    Logger

Constructors

constructor

new Logger(options?)

Parameters

NameType
optionsLoggerOptions

Overrides

BuiltinLogger.constructor

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:36

Properties

console

Readonly console: Console

The console this writes to.

since 1.0.0

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:16


depth

Readonly depth: number

The inspect depth when logging objects.

since 1.0.0

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:34


formats

Readonly formats: Map<LogLevel, LoggerLevel>

The formats supported by the logger.

since 1.0.0

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:22


join

Readonly join: string

The string write will join values by.

since 1.0.0

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:28

Accessors

levels

Private get levels(): Map<LogLevel, LogMethods>

Returns

Map<LogLevel, LogMethods>

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:69


stylize

Static get stylize(): boolean

Gets whether or not colorette is enabled.

since 1.0.0

Returns

boolean

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:77

Methods

preprocess

Protected preprocess(values): string

Pre-processes an array of values.

since 1.0.0

Parameters

NameTypeDescription
valuesreadonly unknown[]The values to pre-process.

Returns

string

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:64


write

write(level, ...values): void

Writes the log message given a level and the value(s).

Parameters

NameTypeDescription
levelLogLevelThe log level.
...valuesreadonly unknown[]The values to log.

Returns

void

Overrides

BuiltinLogger.write

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:50


createFormatMap

Static Private createFormatMap(options?, defaults?): Map<LogLevel, LoggerLevel>

Parameters

NameType
optionsLoggerFormatOptions
defaultsLoggerLevelOptions

Returns

Map<LogLevel, LoggerLevel>

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:81


ensureDefaultLevel

Static Private ensureDefaultLevel(options, defaults, color, name): LoggerLevel

Parameters

NameType
optionsundefined | LoggerLevelOptions
defaultsLoggerLevelOptions
colorColor
namestring

Returns

LoggerLevel

Defined in

projects/plugins/packages/logger/src/lib/Logger.ts:93