# Class ContextLogger

Class
Module
import { ContextLogger } from "@tsed/di"
Source/packages/di/src/domain/ContextLogger.ts

# Overview

class ContextLogger {
id<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>
url<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>
minimalRequestPicker<span class="token punctuation">:</span> Function<span class="token punctuation">;</span>
completeRequestPicker<span class="token punctuation">:</span> Function<span class="token punctuation">;</span>
maxStackSize<span class="token punctuation">:</span> <span class="token keyword">number</span><span class="token punctuation">;</span>





<span class="token keyword">constructor</span><span class="token punctuation">(</span>logger<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> id<span class="token punctuation">,</span> url<span class="token punctuation">,</span> dateStart<span class="token punctuation">,</span> ignoreUrlPatterns<span class="token punctuation">,</span> minimalRequestPicker<span class="token punctuation">,</span> completeRequestPicker<span class="token punctuation">,</span> level<span class="token punctuation">,</span> maxStackSize<span class="token punctuation">,</span> ignoreLog<span class="token punctuation">,</span> additionalProps <span class="token punctuation">}</span><span class="token punctuation">:</span> <a href="/api/di/domain/ContextLoggerOptions.html"><span class="token">ContextLoggerOptions</span></a><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token function">info</span><span class="token punctuation">(</span>obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> this<span class="token punctuation">;</span>
<span class="token function">debug</span><span class="token punctuation">(</span>obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> withRequest?<span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">)</span><span class="token punctuation">:</span> this<span class="token punctuation">;</span>
<span class="token function">warn</span><span class="token punctuation">(</span>obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> this<span class="token punctuation">;</span>
<span class="token function">error</span><span class="token punctuation">(</span>obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> this<span class="token punctuation">;</span>
<span class="token function">trace</span><span class="token punctuation">(</span>obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> this<span class="token punctuation">;</span>
<span class="token function">flush</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</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> | LogLevel<span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>
<span class="token function">destroy</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span>

<span class="token keyword">protected</span> <span class="token function">getDuration</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">number</span><span class="token punctuation">;</span>
<span class="token keyword">protected</span> <span class="token function">getData</span><span class="token punctuation">(</span>obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
<span class="token keyword">protected</span> <span class="token function">run</span><span class="token punctuation">(</span>level<span class="token punctuation">:</span> LogLevel<span class="token punctuation">,</span> obj<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">,</span> mapper<span class="token punctuation">:</span> <span class="token punctuation">(</span>data<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span> =&gt; <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span>

}

# Members

id: string;

url: string;

minimalRequestPicker: Function;

completeRequestPicker: Function;

maxStackSize: number;

info(obj: any): this;

debug(obj: any, withRequest?: boolean): this;

warn(obj: any): this;

error(obj: any): this;

trace(obj: any): this;

flush(): void;

isLevelEnabled(otherLevel: string | LogLevel): boolean;

destroy(): void;

protected getDuration(): number;

Return the duration between the time when LogIncomingRequest has handle the request and now.


protected getData(obj: any): any;

protected run(level: LogLevel, obj: any, mapper: (data: any) => any): void;

Other topics