(configFilename: string, defaultConfig: Log4jsConfig)
| 50 | } |
| 51 | |
| 52 | export function loadLog4jsConfig(configFilename: string, defaultConfig: Log4jsConfig): Log4jsConfig { |
| 53 | if (!yamlExists(configFilename)) { |
| 54 | return defaultConfig |
| 55 | } |
| 56 | |
| 57 | const contents = fs.readFileSync(configFilename, 'utf-8') |
| 58 | const parsedConfig = contents.trim() ? load(contents, { schema: YAML11_SCHEMA }) : undefined |
| 59 | if (isLog4jsConfig(parsedConfig)) { |
| 60 | return parsedConfig |
| 61 | } |
| 62 | |
| 63 | return fatalError(`invalid or unreadable logging config file format; see ${loggingDocsURL}`) |
| 64 | } |
| 65 | |
| 66 | /** |
no test coverage detected