Skip to content

Commit

Permalink
Remove logging config validation that requires default appender to be…
Browse files Browse the repository at this point in the history
… present.
  • Loading branch information
lukeelmers committed Apr 15, 2021
1 parent 3a32817 commit 6e98962
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
12 changes: 0 additions & 12 deletions src/core/server/logging/logging_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ test('`schema` throws if `root` logger does not have appenders configured.', ()
);
});

test('`schema` throws if `root` logger does not have "default" appender configured.', () => {
expect(() =>
config.schema.validate({
root: {
appenders: ['console'],
},
})
).toThrowErrorMatchingInlineSnapshot(
`"[root]: \\"default\\" appender required for migration period till the next major release"`
);
});

test('`getParentLoggerContext()` returns correct parent context name.', () => {
expect(LoggingConfig.getParentLoggerContext('a.b.c')).toEqual('a.b');
expect(LoggingConfig.getParentLoggerContext('a.b')).toEqual('a');
Expand Down
23 changes: 7 additions & 16 deletions src/core/server/logging/logging_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,13 @@ export const config = {
loggers: schema.arrayOf(loggerSchema, {
defaultValue: [],
}),
root: schema.object(
{
appenders: schema.arrayOf(schema.string(), {
defaultValue: [DEFAULT_APPENDER_NAME],
minSize: 1,
}),
level: levelSchema,
},
{
validate(rawConfig) {
if (!rawConfig.appenders.includes(DEFAULT_APPENDER_NAME)) {
return `"${DEFAULT_APPENDER_NAME}" appender required for migration period till the next major release`;
}
},
}
),
root: schema.object({
appenders: schema.arrayOf(schema.string(), {
defaultValue: [DEFAULT_APPENDER_NAME],
minSize: 1,
}),
level: levelSchema,
}),
}),
};

Expand Down

0 comments on commit 6e98962

Please sign in to comment.