Download / ulog

The universal logger
https://ulog.js.org
MIT License
88 stars 19 forks source link

Configurable polling timeout and bugfix in watch.browser #58

Open Messj1 opened 3 years ago

Messj1 commented 3 years ago

Closes #52, fixes #55 and fixes #56 [FEATURE] add poll_time config option to change interval timeout [FEATURE] add bounds for poll_time to prevent unhandy config values [BUGFIX] add a Set to prevent starting multiple interval on already watched ulog instances [BUGFIX] add ulog after hook to update config immediately after loading all mods

Messj1 commented 3 years ago

@Download Have you any idea why the after hook in this pull request does change the level output function to console.log?

I know, a pull request should only focus on one aspect, but the 3 Issues seems to be related on the same time synchronous problem. :see_no_evil:

Messj1 commented 3 years ago

@Download This error seems to be a problem in the test case. The config of ulog contains {log: 'pass'} so the log level become NaN which is true :grin:

The question now: Why are the configs log and test either 'ok' or 'pass'?

I added some console outputs in mods/config/index.js:

update: function(ulog) {
  ...
  var changed = update(ulog.config, newCfg)
  console.log("changed: ", changed);
  ...
},

...

after: function (logger) {
  console.log("after [logger.level]: ", logger.level);
  config.update(this);
  console.log("after [logger.level]: ", logger.level);
}

Console output:

after [logger.level]:  3
changed:  [
  { name: 'test', old: 'ok', new: 'pass' },
  { name: 'log', new: 'pass' },
  { name: 'log_output', new: 'console;test=drain' }
]
after [logger.level]:  NaN