Log
Hierarchy
- Log
Implements
- LogEntry
- Stringifiable
- LogEntry
- Stringifiable
Index
Constructors
Properties
Methods
Constructors
constructor
+ new Log(messageOrProps
: string | Record‹keyof any, any›): Log
Creates an instance Log. Creates an instance Log.
Parameters:
Name | Type | Description |
---|---|---|
messageOrProps | string | 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:
Name | Type | Description |
---|---|---|
options | LogFormatting | Log 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:
Name | Type |
---|---|
description | string |
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:
Name | Type |
---|---|
description | string |
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:
Name | Type | Description |
---|---|---|
methodOrName | AnyFunction | string | Method 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:
Name | Type | Description |
---|---|---|
target | any | The 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:
Name | Type | Description |
---|---|---|
level | LogLevel | Logged 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:
Name | Type | Description |
---|---|---|
description | string | Description of logged metadata entry. |
value? | any | Optional 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.