UNPKG

@bracketed/logger

Version:

An alternative to your run-of-the-mill node console logging functions!

71 lines (68 loc) 1.92 kB
import { LoggerFormatOptions } from './FormatOptions.js'; import { LogLevel } from './ILogger/ILogLevel.js'; import { LoggerLevelOptions } from './LevelOptions.js'; import '../Style/Resolvable.js'; import '../Colouring/index.js'; import '../Style/Options.js'; import '../Style/Background.js'; import '../Style/Effect.js'; import '../Style/Text.js'; import '../Utilities/Timestamp.js'; import '../Style/Style.js'; import '../Timestamper/Timestamp.js'; /** * The logger options. * @since 1.0.0 */ interface LoggerOptions { /** * A writable stream for the output logs. * @since 1.0.0 * @default process.stdout */ stdout?: NodeJS.WritableStream; /** * A writable stream for the error logs. * @since 1.0.0 * @default process.stderr */ stderr?: NodeJS.WritableStream; /** * The default options used to fill all the possible values for {@link LoggerOptions.format}. * @since 1.0.0 * @default options.format.none ?? {} */ defaultFormat?: LoggerLevelOptions; /** * The options for each log level. LogLevel.None serves to set the default for all keys, where only * {@link LoggerTimestampOptions.timestamp} and {@link LoggerLevelOptions.prefix} would be overridden. * @since 1.0.0 * @default {} */ format?: LoggerFormatOptions; /** * The minimum log level. * @since 1.0.0 * @default LogLevel.Info */ level?: LogLevel; /** * The string that joins different messages. * @since 1.0.0 * @default ' ' */ join?: string; /** * The inspect depth when logging objects. * @since 1.0.0 * @default 2 */ depth?: number; /** * A prefix to messages when logging. * @since 1.0.11 * @default undefined */ prefix?: string; } export type { LoggerOptions };