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

Anylogger instance in library never outputs to console in application #17

Closed
MasterKale opened this issue Feb 3, 2021 · 5 comments
Closed

Comments

@MasterKale
Copy link

MasterKale commented Feb 3, 2021

I've implemented anylogger in a library I'm authoring in TypeScript. Unfortunately, the anylogger instance in my library is never updated by any adapters I try to use in an application (also TypeScript) that uses this library, so no logging in my library ever appears in the application's console output.

To keep things simple I'm using import 'anylogger-console' in the application that's consuming my library, but I also have this issue when I try with ulog.

I've created a repo reproducing the issue. The README.md file within contains basic reproduction steps:

https://github.com/MasterKale/anylogger-bug-repro-17

MasterKale added a commit to MasterKale/SimpleWebAuthn that referenced this issue Feb 4, 2021
I thought anylogger would be a good choice for logging but it lead to the following blocker of a bug: Download/anylogger#17

I didn’t want to forget where I logged, though, so I’m leaving it all in but commented out.
@Download
Copy link
Owner

@MasterKale
Thank you for this bug report. I will investigate this as soon as I get some time. In the meantime you might consider investigating it yourself. Anylogger is quite a small script. But I will eventually pick this up.

@Download
Copy link
Owner

@MasterKale Reproduced your issue. Also have a suspicion of what may be happening.
Somehow 2 copies of anylogger are getting into the project I think. I'm not very well versed in Typescript but I made a PR that tests something, maybe it can help you find the problem.

@Download
Copy link
Owner

Download commented Apr 3, 2021

I was able to fix it, though maybe not in the way you want to...
Check my latest PR on the reproduction repo you made.

The symlinked module works differently from the regular modules. I guess symlinked in modules in NPM are still not working correctly. I consider this issue closed because I don't think there is much that anylogger can do about this. If you disagree, feel free to re-open.

@Download Download closed this as completed Apr 3, 2021
@MasterKale
Copy link
Author

Thank you for looking into this, what an odd idiosyncrasy of npm it has revealed. I apologize for not being more communicative while you troubleshot the problem, I was following your progress both here and on the PR and wasn't sure where best to provide any reactions 😅

I'll follow up in the PR. I hope you have a good weekend ✌️

@Download
Copy link
Owner

Download commented Apr 4, 2021

Hey MasterKale, no problem, that's just how it works with Open Source, sometimes people don't have time.

It's very unfortunate that NPM doesn;t support your setup the way it should. It would be really great if it did! I have tried many options but never got a satisfying setup with symlinking. But without it, it's very hard to develop a library as a real separate project from the application without having to publish after each change. The best way for now is to just include myLib as a folder in the actual application project I think and only factor it out into a separate project when the amount of changes it gets becomes smaller.

You could maybe report this as an issue to the NPM team. I guess it should not be impossible to make require aware of the fact that it's in a folder that's outside of node_modules and that it should check the node_modules it came from first.... But then again there is such a huge amount of issues on that project! But you have a pretty complete repro now so maybe it's worth a shot.

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