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


level

โ€ข level: LogLevel

Inherited from

BuiltinLogger.level

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2538


levels

โ–ช Static Protected Readonly levels: Map<LogLevel, LogMethods>

Inherited from

BuiltinLogger.levels

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2548

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

debug

โ–ธ debug(...values): void

Parameters

NameType
...valuesreadonly unknown[]

Returns

void

Inherited from

BuiltinLogger.debug

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2542


error

โ–ธ error(...values): void

Parameters

NameType
...valuesreadonly unknown[]

Returns

void

Inherited from

BuiltinLogger.error

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2545


fatal

โ–ธ fatal(...values): void

Parameters

NameType
...valuesreadonly unknown[]

Returns

void

Inherited from

BuiltinLogger.fatal

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2546


has

โ–ธ has(level): boolean

Parameters

NameType
levelLogLevel

Returns

boolean

Inherited from

BuiltinLogger.has

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2540


info

โ–ธ info(...values): void

Parameters

NameType
...valuesreadonly unknown[]

Returns

void

Inherited from

BuiltinLogger.info

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2543


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


trace

โ–ธ trace(...values): void

Parameters

NameType
...valuesreadonly unknown[]

Returns

void

Inherited from

BuiltinLogger.trace

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2541


warn

โ–ธ warn(...values): void

Parameters

NameType
...valuesreadonly unknown[]

Returns

void

Inherited from

BuiltinLogger.warn

Defined in

node_modules/@sapphire/framework/dist/index.d.ts:2544


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