Skip to content

Documentation / listr2 / ListrLogger

Class: ListrLogger<Levels>

Creates a new Listr2 logger.

This logger is used throughout the renderers for consistency.

See

https://listr2.kilic.dev/renderer/logger.html

Type parameters

Levels extends string = string

Constructors

new ListrLogger(options)

new ListrLogger<Levels>(options?): ListrLogger<Levels>

Parameters

options?: ListrLoggerOptions<Levels>

Returns

ListrLogger<Levels>

Source

packages/listr2/src/utils/logger/logger.ts:16

Properties

process

readonly process: ProcessOutput

Source

packages/listr2/src/utils/logger/logger.ts:14


options?

optional options: ListrLoggerOptions<Levels>

Source

packages/listr2/src/utils/logger/logger.ts:16

Methods

log()

log(level, message, options?): void

Parameters

level: Levels

message: string | any[]

options?: LoggerFieldOptions<false>

Returns

void

Source

packages/listr2/src/utils/logger/logger.ts:30


toStdout()

toStdout(message, options?, eol?): void

Parameters

message: string | any[]

options?: LoggerFieldOptions<false>

eol?: boolean= true

Returns

void

Source

packages/listr2/src/utils/logger/logger.ts:42


toStderr()

toStderr(message, options?, eol?): void

Parameters

message: string | any[]

options?: LoggerFieldOptions<false>

eol?: boolean= true

Returns

void

Source

packages/listr2/src/utils/logger/logger.ts:46


wrap()

wrap(message, options?): string

Parameters

message: string

options?: LoggerFormatOptions

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:50


splat()

splat(...args): string

Parameters

• ...args: [string, ...splat: any[]]

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:58


suffix()

suffix(message, ...suffixes): string

Parameters

message: string

• ...suffixes: LoggerField[]

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:64


prefix()

prefix(message, ...prefixes): string

Parameters

message: string

• ...prefixes: LoggerField[]

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:86


fields()

fields(message, options?): string

Parameters

message: string

options?: LoggerFieldOptions<true>

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:109


icon()

icon(level, icon?): string

Parameters

level: Levels

icon?: string | false

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:129


format()

protected format(level, message, options?): string

Parameters

level: Levels

message: string | any[]

options?: LoggerFieldOptions<false>

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:146


style()

protected style(level, message): string

Parameters

level: Levels

message: string

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:170


applyFormat()

protected applyFormat(message, options?): string

Parameters

message: string

options?: LoggerFormatOptions

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:184


spacing()

protected spacing(message): string

Parameters

message: string

Returns

string

Source

packages/listr2/src/utils/logger/logger.ts:192