Skip to content

ConsoleSink

Defined in: packages/app-logger/src/console-sink.ts:122

A Console implementation backed by a Logger.

Implements the standard Console interface (https://console.spec.whatwg.org/) plus the Node.js extensions (https://nodejs.org/api/console.html#console_console).

group()/groupCollapsed() open a Logger scope (scope-start/ scope-end events) instead of maintaining a hand-rolled indentation stack — any sink downstream of the Logger already knows how to nest/indent a scope.

  • Console

new ConsoleSink(logger, options?): ConsoleSink

Defined in: packages/app-logger/src/console-sink.ts:136

Logger

The logger to write to.

ConsoleSinkOptions

Optional settings for the console sink.

ConsoleSink

Console: {(stdout, stderr?, ignoreErrors?): Console; (options): Console; prototype: Console; }

Defined in: packages/app-logger/src/console-sink.ts:411

new Console(stdout, stderr?, ignoreErrors?): Console

WritableStream

WritableStream

boolean

Console

new Console(options): Console

ConsoleOptions

Console

prototype: Console

Console.Console

assert(condition, …data): void

Defined in: packages/app-logger/src/console-sink.ts:169

unknown

…unknown[]

void

Console.assert


clear(): void

Defined in: packages/app-logger/src/console-sink.ts:191

void

Console.clear


count(label): void

Defined in: packages/app-logger/src/console-sink.ts:324

string

void

Console.count


countReset(label): void

Defined in: packages/app-logger/src/console-sink.ts:332

string

void

Console.countReset


debug(…data): void

Defined in: packages/app-logger/src/console-sink.ts:203

…unknown[]

void

Console.debug


dir(item, options?): void

Defined in: packages/app-logger/src/console-sink.ts:309

unknown

InspectOptions

void

Console.dir


dirxml(…data): void

Defined in: packages/app-logger/src/console-sink.ts:314

…unknown[]

void

Console.dirxml


error(…data): void

Defined in: packages/app-logger/src/console-sink.ts:208

…unknown[]

void

Console.error


group(…data): void

Defined in: packages/app-logger/src/console-sink.ts:347

…unknown[]

void

Console.group


groupCollapsed(…data): void

Defined in: packages/app-logger/src/console-sink.ts:353

…unknown[]

void

Console.groupCollapsed


groupEnd(): void

Defined in: packages/app-logger/src/console-sink.ts:358

void

Console.groupEnd


info(…data): void

Defined in: packages/app-logger/src/console-sink.ts:213

…unknown[]

void

Console.info


log(…data): void

Defined in: packages/app-logger/src/console-sink.ts:218

…unknown[]

void

Console.log


profile(label?): void

Defined in: packages/app-logger/src/console-sink.ts:419

This method does not display anything unless used in the inspector. The console.profile() method starts a JavaScript CPU profile with an optional label until profileEnd is called. The profile is then added to the Profile panel of the inspector.

console.profile('MyLabel');
// Some code
console.profileEnd('MyLabel');
// Adds the profile 'MyLabel' to the Profiles panel of the inspector.

string

void

v8.0.0

Console.profile


profileEnd(label?): void

Defined in: packages/app-logger/src/console-sink.ts:424

This method does not display anything unless used in the inspector. Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. See profile for an example.

If this method is called without a label, the most recently started profile is stopped.

string

void

v8.0.0

Console.profileEnd


table(tabularData, properties?): void

Defined in: packages/app-logger/src/console-sink.ts:223

unknown

string[]

void

Console.table


time(label): void

Defined in: packages/app-logger/src/console-sink.ts:371

string

void

Console.time


timeEnd(label): void

Defined in: packages/app-logger/src/console-sink.ts:393

string

void

Console.timeEnd


timeLog(label, …data): void

Defined in: packages/app-logger/src/console-sink.ts:380

string

…unknown[]

void

Console.timeLog


timeStamp(label?): void

Defined in: packages/app-logger/src/console-sink.ts:414

This method does not display anything unless used in the inspector. The console.timeStamp() method adds an event with the label 'label' to the Timeline panel of the inspector.

string

void

v8.0.0

Console.timeStamp


trace(…data): void

Defined in: packages/app-logger/src/console-sink.ts:293

…unknown[]

void

Console.trace


warn(…data): void

Defined in: packages/app-logger/src/console-sink.ts:304

…unknown[]

void

Console.warn


static patchConsole(target, source): void

Defined in: packages/app-logger/src/console-sink.ts:156

Patches the methods of a target Console object to use the methods of a source Console object.

This can be used to redirect the output of the global console object to an instance of ConsoleSink.

Example: const consoleSink = new ConsoleSink(logger); ConsoleSink.patchConsole(console, consoleSink);

Console

The target Console object to patch

Console

The source Console object to use for the methods

void