Back to Encore

encore.dev/log

docs/ts/runtime/log.mdx

1.57.56.1 KB
Original Source

Enumerations

<!-- symbol-start: LogLevel -->

LogLevel <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L28" />

Enumeration Members

Debug

Debug: number

Error

Error: number

Info

Info: number

Trace

Trace: number

Warn

Warn: number

<!-- symbol-end -->

Interfaces

<!-- symbol-start: Logger -->

Logger <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L36" />

Methods

debug() <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L67" />

debug(msg, fields?): void

Debug logs a message at the debug level.

Parameters
msg

string

fields?

any

Returns

void

error()
Call Signature

error(err, fields?): void

Parameters
err

unknown

fields?

any

Returns

void

Call Signature
ts
error(
   err, 
   msg, 
   fields?): void;
Parameters
err

unknown

msg

string

fields?

any

Returns

void

Call Signature

error(msg, fields?): void

Parameters
msg

string

fields?

any

Returns

void

info() <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L74" />

info(msg, fields?): void

Info logs a message at the info level.

Parameters
msg

string

fields?

any

Returns

void

trace() <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L60" />

trace(msg, fields?): void

Trace logs a message at the trace level.

Parameters
msg

string

fields?

any

Returns

void

warn()
Call Signature

warn(err, fields?): void

Warn logs a message at the warn level.

Parameters
err

unknown

fields?

any

Returns

void

Call Signature
ts
warn(
   err, 
   msg, 
   fields?): void;

Warn logs a message at the warn level.

Parameters
err

unknown

msg

string

fields?

any

Returns

void

Call Signature

warn(msg, fields?): void

Warn logs a message at the warn level.

Parameters
msg

string

fields?

any

Returns

void

with() <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L53" />

with(fields): Logger

Returns a new logger with the given fields added to the context.

Parameters
fields

any

Returns

Logger

withLevel() <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L46" />

withLevel(level): Logger

Returns a new logger with the specified level.

Parameters
level

LogLevel

Returns

Logger

<!-- symbol-end -->

Type Aliases

<!-- symbol-start: FieldsObject -->

FieldsObject <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L26" />

type FieldsObject = Record<string, FieldValue>

A map of fields that can be logged


<!-- symbol-end --> <!-- symbol-start: FieldValue -->

FieldValue <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L12" />

ts
type FieldValue = 
  | string
  | number
  | boolean
  | null
  | undefined
  | FieldsObject
  | FieldValue[];

A field value we support logging

<!-- symbol-end -->

Variables

<!-- symbol-start: default -->

default <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L149" />

const default: Logger

<!-- symbol-end -->

Functions

<!-- symbol-start: debug() -->

debug() <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L166" />

function debug(msg, fields?): void

Debug logs a message at the debug level

Parameters

msg

string

fields?

any

Returns

void


<!-- symbol-end --> <!-- symbol-start: error() -->

error()

Call Signature

function error(err, fields?): void

Error logs a message at the error level

Parameters
err

unknown

fields?

any

Returns

void

Call Signature

ts
function error(
   err, 
   msg, 
   fields?): void;

Error logs a message at the error level

Parameters
err

unknown

msg

string

fields?

any

Returns

void

Call Signature

function error(msg, fields?): void

Error logs a message at the error level

Parameters
msg

string

fields?

any

Returns

void


<!-- symbol-end --> <!-- symbol-start: info() -->

info() <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L173" />

function info(msg, fields?): void

Info logs a message at the info level

Parameters

msg

string

fields?

any

Returns

void


<!-- symbol-end --> <!-- symbol-start: trace() -->

trace() <SymbolSource href="https://github.com/encoredev/encore/blob/main/runtimes/js/encore.dev/log/mod.ts#L159" />

function trace(msg, fields?): void

Trace logs a message at the trace level

Parameters

msg

string

fields?

any

Returns

void


<!-- symbol-end --> <!-- symbol-start: warn() -->

warn()

Call Signature

function warn(err, fields?): void

Warn logs a message at the warn level

Parameters
err

unknown

fields?

any

Returns

void

Call Signature

ts
function warn(
   err, 
   msg, 
   fields?): void;

Warn logs a message at the warn level

Parameters
err

unknown

msg

string

fields?

any

Returns

void

Call Signature

function warn(msg, fields?): void

Warn logs a message at the warn level

Parameters
msg

string

fields?

any

Returns

void

<!-- symbol-end -->