MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / loadLog4jsConfig

Function loadLog4jsConfig

src/lib/log-utils.ts:52–63  ·  view source on GitHub ↗
(configFilename: string, defaultConfig: Log4jsConfig)

Source from the content-addressed store, hash-verified

50}
51
52export 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/**

Callers 2

smartThingsCommandFunction · 0.85
log-utils.test.tsFile · 0.85

Calls 3

yamlExistsFunction · 0.85
isLog4jsConfigFunction · 0.85
fatalErrorFunction · 0.85

Tested by

no test coverage detected