import { schema } from '@osd/config-schema' ; import { Layout } from '@osd/logging' ; import { assertNever } from '@osd/std' ; import { JsonLayout , JsonLayoutConfigType } from './json_layout' ; import { PatternLayout , PatternLayoutConfigType } from './pattern_layout' ; const { oneOf } = schema ; export type LayoutConfigType = PatternLayoutConfigType | JsonLayoutConfigType ; internal export class Layouts { public static configSchema = oneOf ( [ JsonLayout . configSchema , PatternLayout . configSchema ] ) ; param config returns public static create ( config ) { switch ( config . kind ) { case 'json' : return new JsonLayout ( ) ; case 'pattern' : return new PatternLayout ( config . pattern , config . highlight ) ; default : return assertNever ( config ) ; } } }