Initial Commit

This commit is contained in:
2025-08-18 17:18:43 -04:00
commit 1bc3aaa8aa
17 changed files with 373 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import IAppender from './IAppender';
import {LoggingLevel} from '../LoggingLevel';
import assertUnreachable from '../../../lang/assertUnreachable';
export class ConsoleAppender implements IAppender {
append(timestamp: string, level: LoggingLevel, category: string, message: string): void {
switch (level) {
case LoggingLevel.Debug:
case LoggingLevel.Info:
case LoggingLevel.Warning:
case LoggingLevel.Trace:
console.info(`${timestamp} [${category}] ${message}`);
break;
case LoggingLevel.Error:
console.error(`${timestamp} [${category}] ${message}`);
break;
case LoggingLevel.Fatal:
console.error(`${timestamp} [${category}] ${message}`);
break;
case LoggingLevel.Off:
case LoggingLevel.All:
break;
default:
assertUnreachable(level);
}
}
}

View File

@@ -0,0 +1,7 @@
import {LoggingLevel} from '../LoggingLevel';
interface IAppender {
append(timestamp: string, level: LoggingLevel, category: string, message: string): void;
}
export default IAppender;