- added fileNameFormat
All checks were successful
Code quality checks / biome (push) Successful in 11s

- fixed up some logic aka duplicate logic
- actually verify config
-add more ansiColors
-default to no max files
This commit is contained in:
creations 2025-06-11 10:13:27 -04:00
parent 5c88ce3e28
commit f7d2c7084b
Signed by: creations
GPG key ID: 8F553AA4320FC711
8 changed files with 491 additions and 151 deletions

View file

@ -1,6 +1,6 @@
import { ansiColors, logLevelValues } from "@lib/config";
import type { ansiColors, logLevelValues } from "@lib/config";
type LogLevelValue = typeof logLevelValues[keyof typeof logLevelValues];
type LogLevelValue = (typeof logLevelValues)[keyof typeof logLevelValues];
type LogLevel = keyof typeof logLevelValues;
type LoggerConfig = {
@ -9,7 +9,8 @@ type LoggerConfig = {
disableFile?: boolean;
rotate?: boolean;
maxFiles?: number;
maxFiles?: number | null;
fileNameFormat?: string;
console?: boolean;
consoleColor?: boolean;
@ -28,10 +29,30 @@ type LoggerConfig = {
prettyPrint?: boolean;
};
interface PatternContext {
type PatternContext = {
level: LogLevel;
data: unknown;
config: Required<LoggerConfig>;
};
interface PatternTokens {
timestamp?: string;
prettyTimestamp?: string;
levelName?: string;
level?: string;
fileName?: string;
line?: string;
column?: string;
data?: string;
id?: string;
tag?: string;
context?: string;
}
export type { LogLevel, LogLevelValue, LoggerConfig, PatternContext };
export type {
LogLevel,
LogLevelValue,
LoggerConfig,
PatternContext,
PatternTokens,
};