-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCachingLoggerFactory.js
More file actions
36 lines (33 loc) · 1.23 KB
/
CachingLoggerFactory.js
File metadata and controls
36 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* eslint-disable import/extensions */
import ConfigurableLogger from './ConfigurableLogger.js';
import CachingConsole from './CachingConsole.js';
import ConsoleLogger from './ConsoleLogger.js';
import LoggerFactory from './LoggerFactory.js';
export default class CachingLoggerFactory extends LoggerFactory {
static getLogger(category, configArg, configPath, cache) {
const $configArg = (typeof category === 'object' ? category : configArg);
const $category = (typeof category === 'object' ? '' : category);
return new ConfigurableLogger(LoggerFactory.detectConfig($configArg),
new ConsoleLogger($category,
null, null, null,
LoggerFactory.getFormatter($configArg),
new CachingConsole()),
category,
configPath,
cache || LoggerFactory.loggerCategoryCache);
}
constructor(config, cache, configPath) {
super(config, cache, configPath);
CachingLoggerFactory.prototype.getFormatter = LoggerFactory.prototype.getFormatter;
}
getLogger(category) {
return new ConfigurableLogger(this.config,
new ConsoleLogger(category,
null, null, null,
this.getFormatter(this.config),
new CachingConsole()),
category,
this.configPath,
this.cache);
}
}