Options
All
  • Public
  • Public/Protected
  • All
Menu

General Logger class. This class does not log itself, but is a wrapper that wraps logging providers. Each logging provider can decide how and where it logs a log statement.

If you create a new instance, you have to define at least one ProviderFn in the options.

This package delivers an otelProviderFactory function, to create a logging provider that logs a log statement in the otel log format.

example
const logger = new DvelopLogger({
level: "info",// logs info and above
providers: [
// Providers define a loggin scheme. Currently only OTEL is supported.
otelProviderFactory({

appName: "acme-myapp",
appVersion: "1.0.0",
instanceId: "0",

// Transports define where to send the logs. Mutliple transports can be used.
transports: [
consoleTransportFactory(), // logs to console
fileTransportFactory("./logs.txt") // logs to file 'logs.txt'
]
})
],
});

logger.debug({}, "Hello World!");

logger.error({
systemBaseUri: "https://sparta.d-velop.cloud",
tenantId: "T8r3cWM4JII"
}, {
name: "MissionFailedLogger",
message: "Apperently this is Sparta",
error: error,
customAttributes: {
learnings: "Don't stand near a well"
}
});

Hierarchy

  • DvelopLogger

Index

Constructors

Properties

mergeLogEvents: (...events: Partial<DvelopLogEvent>[]) => DvelopLogEvent

Type declaration

Methods

  • debug(context: DvelopContext, message: string): void
  • debug(context: DvelopContext, event: DvelopLogEvent): void
  • error(context: DvelopContext, message: string): void
  • error(context: DvelopContext, event: DvelopLogEvent): void
  • info(context: DvelopContext, message: string): void
  • info(context: DvelopContext, event: DvelopLogEvent): void
  • log(context: DvelopContext, event: DvelopLogEvent, level: DvelopLogLevel): void

Generated using TypeDoc