Skip to main content

Class: Logger

The logger class.

Since

1.0.0

Extends

  • Logger

Constructors

new Logger()

new Logger(options: LoggerOptions): Logger

Parameters

ParameterType
optionsLoggerOptions

Returns

Logger

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


level

level: LogLevel

Inherited from

BuiltinLogger.level

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3720


levels

protected readonly static levels: Map<LogLevel, LogMethods>

Inherited from

BuiltinLogger.levels

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3730

Accessors

levels

Get Signature

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

Returns

Map<LogLevel, LogMethods>

Defined in

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


stylize

Get Signature

get static 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

debug()

debug(...values: readonly unknown[]): void

Alias of ILogger.write with LogLevel.Debug as level.

Parameters

ParameterTypeDescription
...valuesreadonly unknown[]The values to log.

Returns

void

Inherited from

BuiltinLogger.debug

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3724


error()

error(...values: readonly unknown[]): void

Alias of ILogger.write with LogLevel.Error as level.

Parameters

ParameterTypeDescription
...valuesreadonly unknown[]The values to log.

Returns

void

Inherited from

BuiltinLogger.error

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3727


fatal()

fatal(...values: readonly unknown[]): void

Alias of ILogger.write with LogLevel.Fatal as level.

Parameters

ParameterTypeDescription
...valuesreadonly unknown[]The values to log.

Returns

void

Inherited from

BuiltinLogger.fatal

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3728


has()

has(level: LogLevel): boolean

Checks whether a level is supported.

Parameters

ParameterTypeDescription
levelLogLevelThe level to check.

Returns

boolean

Inherited from

BuiltinLogger.has

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3722


info()

info(...values: readonly unknown[]): void

Alias of ILogger.write with LogLevel.Info as level.

Parameters

ParameterTypeDescription
...valuesreadonly unknown[]The values to log.

Returns

void

Inherited from

BuiltinLogger.info

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3725


preprocess()

protected preprocess(values: readonly unknown[]): string

Pre-processes an array of values.

Parameters

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

Returns

string

Since

1.0.0

Defined in

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


trace()

trace(...values: readonly unknown[]): void

Alias of ILogger.write with LogLevel.Trace as level.

Parameters

ParameterTypeDescription
...valuesreadonly unknown[]The values to log.

Returns

void

Inherited from

BuiltinLogger.trace

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3723


warn()

warn(...values: readonly unknown[]): void

Alias of ILogger.write with LogLevel.Warn as level.

Parameters

ParameterTypeDescription
...valuesreadonly unknown[]The values to log.

Returns

void

Inherited from

BuiltinLogger.warn

Defined in

node_modules/@sapphire/framework/dist/esm/index.d.mts:3726


write()

write(level: LogLevel, ...values: readonly unknown[]): void

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

Parameters

ParameterTypeDescription
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()

private static createFormatMap(options: LoggerFormatOptions, defaults: LoggerLevelOptions): Map<LogLevel, LoggerLevel>

Parameters

ParameterType
optionsLoggerFormatOptions
defaultsLoggerLevelOptions

Returns

Map<LogLevel, LoggerLevel>

Defined in

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


ensureDefaultLevel()

private static ensureDefaultLevel(options: undefined | LoggerLevelOptions, defaults: LoggerLevelOptions, color: Color, name: string): LoggerLevel

Parameters

ParameterType
optionsundefined | LoggerLevelOptions
defaultsLoggerLevelOptions
colorColor
namestring

Returns

LoggerLevel

Defined in

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