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

passing the path into the log file and browser console #57

Closed
frankthepunk opened this issue Apr 12, 2018 · 14 comments
Closed

passing the path into the log file and browser console #57

frankthepunk opened this issue Apr 12, 2018 · 14 comments

Comments

@frankthepunk
Copy link

Hi,
my name is Frank,
I got a concern.
Is it possible to log automatically the file name or even better the path of the calling file?
I use your very comfortable NGXLogger inside an Angular-application and the logs are written inside the C# backend.
Of course I could write inside my node.js
this.logger.debug('mySpecial.component.ts | the message');
, but it would be great, when that is integrated in NGXLogger.
Sincerely,
Frank

@frankthepunk frankthepunk changed the title How would you rate the support you received? passing the path into the log file and browser console Apr 12, 2018
@dbfannin
Copy link
Owner

@frankthepunk, funny you should mention this. We just merged in #56 and published [email protected]. this will now log caller file name and line number.

@frankthepunk
Copy link
Author

frankthepunk commented Apr 12, 2018 via email

@dbfannin
Copy link
Owner

it comes automatically. It will be in the message prefix. Let me know if you have problems!

@danibs
Copy link

danibs commented Apr 19, 2018

Hi,
I updated to last version but only console.log shows the real name and position of log

console.log('HELLO console.log');
this.logger.debug('HELLO this.logger.debug');

immagine

@dbfannin
Copy link
Owner

dbfannin commented Apr 19, 2018

@danibs, the file/path name is in the metastring prefix of the logged message. in your case [router.js:4093]. are you saying that this in not the correct filename:lineNumber?

@danibs
Copy link

danibs commented Apr 20, 2018

What I mean is that console.log tell me what is the source of filename:lineNumber and this information is more usefull during development. The two lines:

console.log('HELLO console.log');
this.logger.debug('HELLO this.logger.debug');

are in the same file, the first above the second.
Maybe having both informations will be the best.

@dbfannin
Copy link
Owner

@danibs, it's still not clear to me what the problem is.

Is it that the right hand side file name and line number is different? if so, that is known, and there isn't a solution for that yet.

Is it that the file name and number in the metastring is incorrect? If so, we can look into why this isn't working as expected.

@danibs
Copy link

danibs commented Apr 21, 2018

@dbfannin, what you said <<if so, that is known, and there isn't a solution for that yet>> is the answer of my doubts. I thought that with new version you found a solution for that!

I didn't check if file name and number in the metastring is incorrect, sorry.
Thanks!

@dbfannin
Copy link
Owner

@danibs, no worries! Still looking for a way to reflect the file name line number on the RHS.

@danibs
Copy link

danibs commented Apr 21, 2018

@dbfannin, I thought to one thing: maybe that Node, during compile, translate console.log adding file informations?
My fault that I didn't look inside "compiled" files...

@danibs
Copy link

danibs commented Apr 22, 2018

@dbfannin, I check inside transpilled file and console.log is not changed or translated to something else.

I found this: https://stackoverflow.com/a/49283274
Could it help you?

Thanks!

@dbfannin
Copy link
Owner

closing as a duplicate of #69

@marcustran98
Copy link

marcustran98 commented Aug 5, 2021

@dbfannin
image
how i change ./src/app/app.component.ts:222 -> webpack:///./src/app/app.component.ts:222? please help me :D

@bmtheo
Copy link
Collaborator

bmtheo commented Aug 5, 2021

I think for now it's not possible, it's coming with V5 :)

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

5 participants