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

Log messages do not show source(file:line) #96

Open
jakubgs opened this issue Aug 4, 2016 · 3 comments
Open

Log messages do not show source(file:line) #96

jakubgs opened this issue Aug 4, 2016 · 3 comments

Comments

@jakubgs
Copy link

jakubgs commented Aug 4, 2016

Hi,

I'm really liking the simplicity of your library but it looks to me that when I use it the Firefox console(haven't tested other browsers) does not show the source of the message - meaning file and line from which it came. It shows up only as (unknown).

Screenshot:
loglevel_unknown

Is this fixable? Is there anything I can do in my code to make it work?

Cheers!

@pimterry
Copy link
Owner

pimterry commented Aug 6, 2016

Can you include the code you're using to do this? And the version number of your firefox?

I'm not sure why this is happening. I've done some quick tests and it looks like it's a recent change in Firefox. In version 44, all log messages come through fine with lines, but in version 48 they don't.

It seems like maybe firefox has just disabled tracing entirely. console.warn("hi") for me in Firefox 48 doesn't include any source information at all, and console.warn.bind(console)("hi") - more or less the same as what loglevel is doing internally - prints 'unknown' in the same way you're seeing.

Long story short, it looks like a firefox problem. I'm happy to implement workarounds if you can think of them, and find a good way to detect this case. You do still get stack traces from console.error, and thereby log.error too, which could be a potential solution for your code for now. The right solution is probably to talk to the firefox team though, and get them to put log source tracing back in.

@jakubgs
Copy link
Author

jakubgs commented Aug 8, 2016

Sorry for the late reply but I was out.

I'll check if this is Firefox specific and if bound to a certain version tomorrow at work. Cheers!

@jakubgs
Copy link
Author

jakubgs commented Aug 9, 2016

So I just tested this on my linux desktop at work which runs 48.0 and I get (unknown). Also checked with a friend that was running 47.0 on a Mac and it did the same thing.

But when I test it on my laptop which run 45.3.0 I see source of the message just fine.

loglevel_ff_45 3

Seems like something that Firefox broke with one of it's recent releases.

The way I use your code is kinda convoluted. I build a GreaseMonkey script using webpack out of multiple modules through the CommonJS pattern and I include your module through a LOG = require('loglevel') call which results in a code that has multiple layers of modules using function closure.

Aside from that just run LOG.info('whatever') like any normal person would.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants