-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (50 loc) · 1.1 KB
/
Copy pathindex.js
File metadata and controls
56 lines (50 loc) · 1.1 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var grab = require('../../core/grab')
// var args = require('./args')
// var env = require('./env')
var read = require('./read')
var update = require('./update')
var notify = require('./notify')
var watch = require('./watch')
var config = module.exports = {
use: [
require('../settings')
],
settings: {
config: {
config: 'log_config'
},
pollTime: {
config: 'poll_time',
prop: {
default: 350
}
}
},
init: function(){
this.get('config')
},
get: function(result, name) {
if (! this.config) {
config.update(this)
}
if (!result) {
var settings = grab(this, 'settings', {})
name = settings[name] && settings[name].config || name
result = this.config[name]
}
return result
},
update: function(ulog) {
ulog.config = ulog.config || {}
var newCfg = read(ulog)
var changed = update(ulog.config, newCfg)
if (changed.length) notify(ulog, changed)
watch(ulog)
},
set: function(name) {
if (name === 'log_config') config.update(this)
},
after: function () {
config.update(this);
}
}