Debug and info log levels backwards ?

37 views
Skip to first unread message

Carlos Ramos

unread,
Jul 23, 2016, 11:37:30 AM7/23/16
to sails.js
Hey there guys, new to sails here, so far it looks great and I'm loving it.

There is one thing that giving me trouble though. It seems to me that the log priority for levels info and debug are backwards. In the docs debug has a lower priority than info but in this issue it's stated that Sails follows NPM's logging conventions referencing npmlog's documentation. Also, Sails docs mention using Winston as custom logger which is great but also disagree with Sails on the priorities as you can see here.

In the end, this are the logging priorities.

NPM: { error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }
Syslog: { emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }

{ error: 0, warn: 1, http: 2, info: 3, verbose: 4, silly: 5 }

{ error: 0, warn: 1, info: 2, logs: 3, debug: 4 }

{ off: 0, error: 1, warn: 2, info: 3, debug: 4 }

{ silent: 0, error: 1, warn: 2, debug: 3, info: 4, verbose: 5, silly: 5 }

As you can see, most except for Sails agree that info is closer to warn than debug. So my questions:

1- Does Sails actually have the log priorities/levels different than the rest of the world?
2- If it does, should we change it to match the rest of the world?
3- Is it possible to change those priorities just for my app in the config without causing havok on the rest of the framework ?

Why is this order important ?. Well it turns out that, like most, I use third party libraries in my applications. Some of this third party libraries accept a log object as parameter to be used instead of just using console.log. And it's here where it becomes obvious that the log priorities of these libraries are different than Sail's.

Thanks a lot for your time.
Cheers.

Core E

unread,
Jul 23, 2016, 11:40:14 AM7/23/16
to Carlos Ramos, sails.js

Hey Carlos. I experienced this headache a few months back and particlebanana helped resolve with me. If you search through the issues in the repo you'll see some solutions for it.

Carlos Ramos

unread,
Jul 23, 2016, 12:03:11 PM7/23/16
to sails.js, carr...@gmail.com
Hi Core,

Thanks for your time. I have indeed looked in the Github issues and what I found as I linked in the original post is confusion. People stating that Sails follows NPM logging levels when it does not seem to be the case. And then this issue where it's stated that because Winston follows NPM's logging levels it's not working and the recommendation is to change Winston log levels to match Sails's.

So again these are my questions:

1- Does Sails actually have the log priorities/levels different than the rest of the world?
2- If it does, should we change it to match the rest of the world?
3- Is it possible to change those priorities just for my app in the config without causing havok on the rest of the framework?

And again, thanks a lot for your time.
Cheers.
Reply all
Reply to author
Forward
0 new messages