nanoservice-ts v0.1.0


nanoservice-ts / runner/src / DefaultLogger

Class: DefaultLogger

Defined in: core/runner/src/DefaultLogger.ts:8

DefaultLogger class extends GlobalLogger to provide logging functionality with additional metadata such as workflow name, workflow path, request ID, environment, and application name.

Extends

  • default

Constructors

new DefaultLogger()

new DefaultLogger(workflowName?, workflowPath?, requestId?): DefaultLogger

Defined in: core/runner/src/DefaultLogger.ts:41

Constructs a new DefaultLogger instance.

Parameters

workflowName?

string

The name of the workflow.

workflowPath?

string

The path of the workflow.

requestId?

string

The ID of the request.

Returns

DefaultLogger

Overrides

GlobalLogger.constructor

Properties

appName

appName: undefined | string = ""

Defined in: core/runner/src/DefaultLogger.ts:32

The name of the application.


env

env: undefined | string = ""

Defined in: core/runner/src/DefaultLogger.ts:27

The environment in which the application is running.


logs

protected logs: string[]

Defined in: core/shared/dist/GlobalLogger.d.ts:3

Inherited from

GlobalLogger.logs


requestId

requestId: undefined | string = ""

Defined in: core/runner/src/DefaultLogger.ts:22

The ID of the request.


workflowName

workflowName: undefined | string = ""

Defined in: core/runner/src/DefaultLogger.ts:12

The name of the workflow.


workflowPath

workflowPath: undefined | string = ""

Defined in: core/runner/src/DefaultLogger.ts:17

The path of the workflow.

Methods

error()

error(message, stack): void

Defined in: core/runner/src/DefaultLogger.ts:77

Logs an error message to the console with metadata.

Parameters

message

string

The error message to log.

stack

string = ""

The stack trace (optional).

Returns

void

Overrides

GlobalLogger.error


getLogs()

getLogs(): string[]

Defined in: core/shared/dist/GlobalLogger.d.ts:8

Returns

string[]

Inherited from

GlobalLogger.getLogs


getLogsAsBase64()

getLogsAsBase64(): string

Defined in: core/shared/dist/GlobalLogger.d.ts:10

Returns

string

Inherited from

GlobalLogger.getLogsAsBase64


getLogsAsText()

getLogsAsText(): string

Defined in: core/shared/dist/GlobalLogger.d.ts:9

Returns

string

Inherited from

GlobalLogger.getLogsAsText


injectMetadata()

injectMetadata(message, level, stack): string

Defined in: core/runner/src/DefaultLogger.ts:90

Injects metadata into a log message.

Parameters

message

string

The message to inject metadata into.

level

string = "info"

The log level (default is “info”).

stack

string = ""

The stack trace (optional).

Returns

string

The message with injected metadata.


log()

log(message): void

Defined in: core/runner/src/DefaultLogger.ts:55

Logs a message to the console with metadata.

Parameters

message

string

The message to log.

Returns

void

Overrides

GlobalLogger.log


logLevel()

logLevel(level, message): void

Defined in: core/runner/src/DefaultLogger.ts:66

Logs a message to the console with a specified log level and metadata.

Parameters

level

string

The log level (e.g., “info”, “error”).

message

string

The message to log.

Returns

void

Overrides

GlobalLogger.logLevel