This commit is contained in:
2025-12-04 15:15:24 +01:00
parent b7d5551ea7
commit c698a0b893
119 changed files with 1167 additions and 2652 deletions

View File

@@ -1,4 +1,6 @@
import type { ILogger, LogContext, LogLevel } from '../../../application/ports/ILogger';
import type { LoggerPort } from '@gridpilot/automation/application/ports/LoggerPort';
import type { LogContext } from '@gridpilot/automation/application/ports/LoggerContext';
import type { LogLevel } from '@gridpilot/automation/application/ports/LoggerLogLevel';
import { loadLoggingConfig, type LoggingEnvironmentConfig } from '../../config/LoggingConfig';
const LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {
@@ -18,7 +20,7 @@ const LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {
*
* This provides structured JSON logging to stdout with the same interface.
*/
export class PinoLogAdapter implements ILogger {
export class PinoLogAdapter implements LoggerPort {
private readonly config: LoggingEnvironmentConfig;
private readonly baseContext: LogContext;
private readonly levelPriority: number;
@@ -106,7 +108,7 @@ export class PinoLogAdapter implements ILogger {
this.log('fatal', message, context, error);
}
child(context: LogContext): ILogger {
child(context: LogContext): LoggerPort {
return new PinoLogAdapter(this.config, { ...this.baseContext, ...context });
}