adzejs / adze

A universal, modern, and extensible logging library for JavaScript and TypeScript.
https://adzejs.com/
Apache License 2.0
223 stars 8 forks source link

Triggering group logging requests with emojis breaks things #177

Closed alexrass closed 1 month ago

alexrass commented 1 month ago
adze.withEmoji.group.info('title')
adze.info('abc')
adze.groupEnd.info()

That results in some weird output, extra groupings, and logs no longer working

AJStacy commented 1 month ago

Hey @alexrass, I'm not able to effectively reproduce this problem with the information provided in this issue. Please provide details of the environment in which you're running this code. Browser, node, bun?

Perhaps you have an unclosed group elsewhere that is nesting all subsequent logs? What does the output look like that you're reporting is weird?

I'm happy to help resolve this, but I need more information.

AJStacy commented 1 month ago

Hi @alexrass ,

Again, I'm not able to reproduce the issue based on the information provided and by running my own tests to confirm that it is working as intended. I will be closing this ticket soon unless you are able to respond with more details. If the issue persists, please open another ticket and be sure to provide more details about your issue. Thank you!

alexrass commented 1 month ago

Ahh sorry -- this is in google chrome. No other nested grouping -- I could replicate directly in the console outside of my codebase

image

AJStacy commented 1 month ago

Your problem is your logger is not calling the seal() method.

// incorrect
const l = logger.withEmoji;
// correct
const l = logger.withEmoji.seal();

When you don't call seal, what's happening is that each time you call l.something your modifying the same log instance rather than creating a new one.

Refer to this page of the docs: https://adzejs.com/getting-started/setup.html#create-a-shared-logger