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

Messages not aligned, emoji not visible #47

Open
rlnt opened this issue Aug 19, 2020 · 6 comments
Open

Messages not aligned, emoji not visible #47

rlnt opened this issue Aug 19, 2020 · 6 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@rlnt
Copy link

rlnt commented Aug 19, 2020

Describe the bug
The default log messages are not correctly aligned in the terminal.
Also the emoji for the warning is not correctly displayed.

Information about your versions
Zoya: 1.0.1
Node: 14.8.0
npm: 6.14.7
VSCode: 1.48.0

I am using the Linux sub system for Windows (WSL) with Ubuntu 20.04.
I swapped the integrated terminal in my VSCode to the WSL terminal.
Currently using the ZSH shell with Oh-My-ZSH and the powerlevel10k theme.

Furhter information
Here is a screenshot of my code and how it looks in the console.

As you can see the last emoji is not visible correctly and the lines have different
starting points and are not aligned equally.

@WoLfulus
Copy link
Owner

I'm aware of this problem, but I'm unsure how to handle it properly. I'll have to check with some more time later.

@WoLfulus WoLfulus added the bug Something isn't working label Aug 19, 2020
@Chronophylos
Copy link

Chronophylos commented Aug 19, 2020

The warning emoji not showing is not a problem with the library. Your Terminal Font does not support this emoji.

About the alignment, my guess would be that you're counting the chars (2 Bytes) and not the Graphemes. Unicode Symbols are often composed of multiple chars. Either hardcode the emoji lenght or find a way to count the graphemes.
See this blog post for more information about unicode strings.

@Chronophylos
Copy link

Libraries that do that:

@WoLfulus
Copy link
Owner

Wow! Thank you! I didn't know about that.

I'll patch the problem.

@WoLfulus WoLfulus changed the title [bug] messages not aligned, emoji not visible Messages not aligned, emoji not visible Aug 19, 2020
@rlnt
Copy link
Author

rlnt commented Aug 19, 2020

The emoji issue is solved by changing my console font. It seems like the warning emoji was the only one I didn't have. Maybe it's just not that popular and therefor wasn't included in the old font I used.

Glad that you will patch it, this logger looks nice. :)
Do you also plan to support whole error object logging when using zoya.error()? It currently only supports String and is not able to print a stacktrace properly.
Reference (this is how signale does it): https://www.npmjs.com/package/signale#usage

Sadly Signale was abandoned, that's why I am searching for an alternative logger and yours looks quite similar. :)

@WoLfulus
Copy link
Owner

Zoya is in fact based on it. I was going to use signale for a project but I dropped it since it didn't support switching from text to JSON (for deployment and log aggregation), that's when I decided to rewrite it.

I'll take a look at the error reporting.

@WoLfulus WoLfulus added the enhancement New feature or request label Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants