import { schema } from '@osd/config-schema' ; import { assertNever } from '@osd/std' ; import { DisposableAppender } from '@osd/logging' ; import { LegacyAppender , LegacyAppenderConfig , } from '../../legacy/logging/appenders/legacy_appender' ; import { Layouts } from '../layouts/layouts' ; import { ConsoleAppender , ConsoleAppenderConfig } from './console/console_appender' ; import { FileAppender , FileAppenderConfig } from './file/file_appender' ; /**
 * Config schema for validting the shape of the `appenders` key in in  LoggerContextConfigType or
 *  LoggingConfigType .
 *
 *  public export const appendersSchema = schema . oneOf ( [ ConsoleAppender . configSchema , FileAppender . configSchema , LegacyAppender . configSchema , ] ) ; public export type AppenderConfigType = ConsoleAppenderConfig | FileAppenderConfig | LegacyAppenderConfig ; internal export class Appenders { public static configSchema = appendersSchema ; param config returns public static create ( config ) { switch ( config . kind ) { case 'console' : return new ConsoleAppender ( Layouts . create ( config . layout ) ) ; case 'file' : return new FileAppender ( Layouts . create ( config . layout ) , config . path ) ; case 'legacy-appender' : return new LegacyAppender ( config . legacyLoggingConfig ) ; default : return assertNever ( config ) ; } } }