Open justmike opened 7 years ago
I just ran into the same issue. Here is an example work around:
Create a custom layout, that is functionally identical to the pattern
layout:
const log4js = require('log4js');
const layouts = require('log4js/lib/layouts');
log4js.addLayout('my-layout', function (config) {
return layouts.patternLayout(config && config.pattern, config && config.tokens);
});
The configuration can now be written as:
loggers: [
{
type: 'console',
layout: {
type: 'my-layout',
pattern: '%[%d{ISO8601}:%p [%c]: %]%m'
}
}
]
Expected behaviour
In
karma/lib/logger.js
,setup
should use thelayout.pattern
string if it exists.Actual behaviour
When
layout.type === 'pattern'
,setup
only uses one of the built-in constants:Environment Details
karma --version
): 1.3.0karma.config.js
fileSteps to reproduce the behaviour
karma.config.js
as specified above.Comment
If this is indeed broken, I can submit a PR.
Further, I realize that fixing this to use the provided
pattern
will then ignore thecolors
boolean. This might be addressed by havinglayout.colorPattern
andlayout.noColorPattern
which get assigned appropriately tolayout.pattern
. I can submit a PR for this as well.Thanks.