import { schema } from '@kbn/config-schema' ; import { assertNever } from '@kbn/std' ; import { DisposableAppender } from '@kbn/logging' ; import { Layouts } from '../layouts/layouts' ; import { ConsoleAppender , ConsoleAppenderConfig } from './console/console_appender' ; import { FileAppender , FileAppenderConfig } from './file/file_appender' ; import { RewriteAppender , RewriteAppenderConfig } from './rewrite/rewrite_appender' ; import { RollingFileAppender , RollingFileAppenderConfig , } from './rolling_file/rolling_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 , RewriteAppender . configSchema , RollingFileAppender . configSchema , ] ) ; public export type AppenderConfigType = ConsoleAppenderConfig | FileAppenderConfig | RewriteAppenderConfig | RollingFileAppenderConfig ; internal export class Appenders { public static configSchema = appendersSchema ; param config returns public static create ( config ) { switch ( config . type ) { case 'console' : return new ConsoleAppender ( Layouts . create ( config . layout ) ) ; case 'file' : return new FileAppender ( Layouts . create ( config . layout ) , config . fileName ) ; case 'rewrite' : return new RewriteAppender ( config ) ; case 'rolling-file' : return new RollingFileAppender ( config ) ; default : return assertNever ( config ) ; } } }