This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
56 lines (49 loc) · 1.63 KB
/
index.js
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const cluster = require('cluster');
const logger = require('./src/logger');
const formatters = require('./src/formatters');
const filter = require('./src/filter');
const socket = require('./src/socket');
const formattersCollection = require('./lib/formatters');
const destination = require('./src/destination');
const variables = require('./src/variables');
if (cluster.isWorker) {
destination.setTTY();
}
// Remove timestamp and color from "debug" package
process.env.DEBUG_HIDE_DATE = process.env.DEBUG_HIDE_DATE || true;
process.env.DEBUG_COLORS = process.env.DEBUG_COLORS || 0;
process.env.KITTEN_LOGGER = process.env.KITTEN_LOGGER || process.env.DEBUG || '*';
process.env.KITTEN_LOGGER_LEVEL = process.env.KITTEN_LOGGER_LEVEL|| 'INFO';
if (process.env.KITTEN_LOGGER_IS_LOADED) {
variables.isLoggerChild = true;
}
filter.filter();
logger.enable();
module.exports = {
createLogger : logger.logger,
createPersistentLogger : logger.persistentLogger,
addFormatter : formatters.add,
init : require('./src/init'),
/**
* Filter namespace
* @param {String} namespace
*/
filter : function (namespace) {
filter.filter(namespace);
logger.enable();
},
/**
* Filter level
* @param {String} level
*/
filterLevel : function (level) {
if (level) {
process.env.KITTEN_LOGGER_LEVEL = level.toUpperCase();
}
logger.enableLevels();
},
formattersCollection : formattersCollection,
listen : socket.listen,
connect : socket.connect,
sendAction : socket.send
};