# Logger Class

Module
import { Logger } from "@tsed/logger"
Source/packages/logger/src/logger/class/Logger.ts

# Overview

class Logger {
/**
 *
 */
<span class="token keyword">constructor</span><span class="token punctuation">(</span>_name?<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

get <span class="token function">appenders</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/logger/logger/class/LoggerAppenders.html"><span class="token">LoggerAppenders</span></a><span class="token punctuation">;</span>

get <span class="token function">level</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>
set <span class="token function">level</span><span class="token punctuation">(</span>level<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
/**
 *
 */

get <span class="token function">context</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Map&lt;<span class="token keyword">any</span><span class="token punctuation">,</span> <span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>
get <span class="token function">name</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>
set <span class="token function">name</span><span class="token punctuation">(</span>value<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
/**
 * Create stack trace  the lines of least Logger.
 * @returns <span class="token punctuation">{</span><span class="token keyword">string</span><span class="token punctuation">}</span>
 */
<span class="token keyword">static</span> <span class="token function">createStack</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>
<span class="token function">isLevelEnabled</span><span class="token punctuation">(</span>otherLevel<span class="token punctuation">:</span> <span class="token keyword">string</span> | <a href="/api/logger/core/LogLevel.html"><span class="token">LogLevel</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>
/**
 * Prints to stdout with newline. Multiple arguments can be passed<span class="token punctuation">,</span> with the first used <span class="token keyword">as</span> the primary message and all additional used <span class="token keyword">as</span> substitution values similar to <span class="token function">printf</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">(</span>the arguments are all passed to util.<span class="token function">format</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>.
 * @param data
 * @returns <span class="token punctuation">{</span><span class="token keyword">any</span><span class="token punctuation">}</span>
 */
<span class="token function">debug</span><span class="token punctuation">(</span>...data<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>
/**
 *
 * @param data
 * @returns <span class="token punctuation">{</span><span class="token keyword">any</span><span class="token punctuation">}</span>
 */
<span class="token function">info</span><span class="token punctuation">(</span>...data<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>
/**
 *
 * @param data
 * @returns <span class="token punctuation">{</span><span class="token keyword">any</span><span class="token punctuation">}</span>
 */
<span class="token function">warn</span><span class="token punctuation">(</span>...data<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>
/**
 * Prints to stderr with newline. Multiple arguments can be passed<span class="token punctuation">,</span> with the first used <span class="token keyword">as</span> the primary
 * message and all additional used <span class="token keyword">as</span> substitution values similar to <span class="token function">printf</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">(</span>the arguments are all
 * passed to util.<span class="token function">format</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>.
 * @param data
 * @param args
 * @returns <span class="token punctuation">{</span><span class="token keyword">any</span><span class="token punctuation">}</span>
 */
<span class="token function">error</span><span class="token punctuation">(</span>...data<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>
<span class="token function">fatal</span><span class="token punctuation">(</span>...data<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>
/**
 *
 * @param data
 * @returns <span class="token punctuation">{</span>Logger<span class="token punctuation">}</span>
 */
<span class="token function">trace</span><span class="token punctuation">(</span>...data<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>
/**
 *
 */
<span class="token function">start</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>
/**
 *
 */
<span class="token function">stop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>
/**
 *
 * @returns <span class="token punctuation">{</span>Promise&lt;TAll<span class="token punctuation">[</span><span class="token punctuation">]</span>&gt;<span class="token punctuation">}</span>
 */
<span class="token function">shutdown</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Promise&lt;<span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span>&gt;<span class="token punctuation">;</span>
/**
 *
 * @param list
 * @param settings
 */
<span class="token function">drawTable</span><span class="token punctuation">(</span>list<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> settings?<span class="token punctuation">:</span> <a href="/api/logger/logger/utils/ITableSettings.html"><span class="token">ITableSettings</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>
/**
 *
 * @param list
 * @param settings
 * @returns <span class="token punctuation">{</span>Logger<span class="token punctuation">}</span>
 */
<span class="token function">printTable</span><span class="token punctuation">(</span>list<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> settings?<span class="token punctuation">:</span> <a href="/api/logger/logger/utils/ITableSettings.html"><span class="token">ITableSettings</span></a><span class="token punctuation">)</span><span class="token punctuation">:</span> this<span class="token punctuation">;</span>
/**
 *
 * @returns <span class="token punctuation">{</span>Logger<span class="token punctuation">}</span>
 */

}

# Members

get appenders(): LoggerAppenders;

get level(): string;

set level(level: string);

get context(): Map<any, any>;

get name(): string;

set name(value: string);

static createStack(): string;

Create stack trace the lines of least Logger.


isLevelEnabled(otherLevel: string | LogLevel): boolean;

debug(...data: any[]): Logger;

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf() (the arguments are all passed to util.format()).


info(...data: any[]): Logger;

warn(...data: any[]): Logger;

error(...data: any[]): Logger;

Prints to stderr with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf() (the arguments are all passed to util.format()).


fatal(...data: any[]): Logger;

trace(...data: any[]): Logger;

start(): Logger;

stop(): Logger;

shutdown(): Promise<any[]>;

drawTable(list: any[], settings?: ITableSettings): string;

printTable(list: any[], settings?: ITableSettings): this;

Other topics