# ConsoleAppender Class private

Module
import { ConsoleAppender } from "@tsed/logger"
Source/packages/logger/src/appenders/components/ConsoleAppender.ts

# Overview

class ConsoleAppender extends BaseAppender {
<span class="token function">write</span><span class="token punctuation">(</span>loggingEvent<span class="token punctuation">:</span> <a href="/api/logger/core/LogEvent.html"><span class="token">LogEvent</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span>

}

# Description

# Console Appender

This appender uses node’s console object to write log events. It can also be used in the browser, if you’re using browserify or something similar. Be aware that writing a high volume of output to the console can make your application use a lot of memory. If you experience this problem, try switching to the stdout appender.

# Configuration

  • type - console
  • layout - object (optional, defaults to colouredLayout) - see layouts

Note that all log events are output using console.log regardless of the event’s level (so ERROR events will not be logged using console.error)

# Example

import {Logger} from "ts-log-debug";

const logger = new Logger("loggerName");

logger.appenders.set("console", {
    type: "console",
    levels: ["debug", "info", "trace"]
});
1
2
3
4
5
6
7
8

# Members

write(loggingEvent: LogEvent): void;

Other topics