Skip to main content

DefaultLogger

DefaultLogger

The default logger, which logs to the console (stdout) with optional timestamps. Since this logger is part of the default Vendure configuration, you do not need to specify it explicitly in your server config. You would only need to specify it if you wish to change the log level (which defaults to LogLevel.Info) or remove the timestamp.

Example

import { DefaultLogger, LogLevel, VendureConfig } from '@vendure/core';

export config: VendureConfig = {
// ...
logger: new DefaultLogger({ level: LogLevel.Debug, timestamp: false }),
}
Signature
class DefaultLogger implements VendureLogger {
constructor(options?: { level?: LogLevel; timestamp?: boolean })
setDefaultContext(defaultContext: string) => ;
error(message: string, context?: string, trace?: string | undefined) => void;
warn(message: string, context?: string) => void;
info(message: string, context?: string) => void;
verbose(message: string, context?: string) => void;
debug(message: string, context?: string) => void;
}

constructor

method
(options?: { level?: LogLevel; timestamp?: boolean }) => DefaultLogger

setDefaultContext

method
(defaultContext: string) =>

error

method
(message: string, context?: string, trace?: string | undefined) => void

warn

method
(message: string, context?: string) => void

info

method
(message: string, context?: string) => void

verbose

method
(message: string, context?: string) => void

debug

method
(message: string, context?: string) => void