Log

Hierarchy

  • Log

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

+ new Log(messageOrProps: string | Record‹keyof any, any›): Log

Creates an instance Log. Creates an instance Log.

Parameters:

NameTypeDescription
messageOrPropsstring | Record‹keyof any, any›Message of a log as a string or log properties.

Returns: Log

Properties

level

level: LogLevel

Implementation of LogEntry.level


Readonly message

message: string

Implementation of LogEntry.message


Readonly metadata

metadata: Map‹string, LogMetadata›

Implementation of LogEntry.metadata


Optional method

method? : function

Implementation of LogEntry.method

Type declaration:

▸ (): AnyFunction


Optional methodName

methodName? : string

Implementation of LogEntry.methodName


Readonly options

options: LogFormatting

Implementation of LogEntry.options


Optional typeName

typeName? : TypeName | undefined

Implementation of LogEntry.typeName

Methods

format

format(options: LogFormatting): this

Implementation of LogEntry

Sets additional formatting options for log entry.

Parameters:

NameTypeDescription
optionsLogFormattingLog formatting options as an object.

Returns: this

Instance of self.


getMetadata

getMetadata(description: string): LogMetadata | undefined

Implementation of LogEntry

Returns metadata for log entry.

Parameters:

NameType
descriptionstring

Returns: LogMetadata | undefined

LogMetadata instance if present.


getTarget

getTarget(): any

Implementation of LogEntry

Returns target.

Returns: any

Class instance.


hasMetadata

hasMetadata(description: string): boolean

Implementation of LogEntry

Evaluates if log entry has metadata with description set on collection.

Parameters:

NameType
descriptionstring

Returns: boolean

Returns true if log entry has metadata, else false.


in

in(methodOrName: AnyFunction | string): this

Implementation of LogEntry

Sets method in which log is invoked or it's name.

Parameters:

NameTypeDescription
methodOrNameAnyFunction | stringMethod in which log is invoked or its name.

Returns: this

Instance of self.


isStaticMethod

isStaticMethod(): boolean

Implementation of LogEntry

Evaluates if defined method is a static method.

Returns: boolean

Returns true if is static method, else false.


on

on(target: any): this

Implementation of LogEntry

Sets target of the log.

Parameters:

NameTypeDescription
targetanyThe target on which log is logged(class).

Returns: this

Instance of self.


setLevel

setLevel(level: LogLevel): this

Implementation of LogEntry

Sets logging level for which log entry is logged.

Parameters:

NameTypeDescription
levelLogLevelLogged level.

Returns: this


toString

toString(): string

Implementation of Stringifiable

Converts log to string representation.

Returns: string

Log message as a string.


with

with(description: string, value?: any, keys?: string[]): this

Implementation of LogEntry

Adds additional metadata about log entry.

Parameters:

NameTypeDescription
descriptionstringDescription of logged metadata entry.
value?anyOptional logged value.
keys?string[]Optional array of properties keys when provided value is an object. Allows to display only selected ones back on log entry.

Returns: this

Instance of self.