Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is log_config being honored? #62

Open
mozart27 opened this issue Apr 15, 2021 · 1 comment
Open

Is log_config being honored? #62

mozart27 opened this issue Apr 15, 2021 · 1 comment
Labels

Comments

@mozart27
Copy link

I am having trouble getting log_config to be honored. When I specify log_config like this:

    "watch:serve": "export log_config=./local.config.prod && ts-node-dev --respawn ./src/server.ts",

ulog does not pick up the filename from the log_config env var.

I am likely using this improperly and the example in your documentation does not provide a practical example (it shows log_config=./my.log.config). It is possible I am missing something in the docs though.

I have also tried this:

ulog.set('log_config', './log.config.dev');

Is there something I would need to do w/r to ulog to get it to reload configs from file?

Any help would be greatly appreciated.

@Download
Copy link
Owner

Download commented May 5, 2021

I have to admit this feature has not been tested very extensively yet.
Did you try with an absolute file path?

I quickly took a look at the code that reads the config and it seems maybe there is a bug there:

module.exports = function(ulog, callback) {
  var settings = grab(ulog, 'settings', {})
  var log_config = ulog.get('log_config') || 'log.config'
  ..

https://github.com/Download/ulog/blob/master/mods/config/read.js#L11

It seems I messed up here. I should have written:

  var log_config = ulog.get('config') || 'log.config'

When using ulog.get we should use the setting name (config) and not the config alias (log_config) but alas I think I messed up here.

If you go into node_modules/ulog/mods/config and open read.js you can hack this line and change it. Does that fix it for you? If so, we can quickly fix this. I am swamped in work atm so it may take some time for me to try this myself but eventually I will fix this. But maybe you can help?

@mozart27

@Download Download added the bug label May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants