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
Logger constants refactored, format
argument added, better formatting of failed (non) equality assertions
#9315
Conversation
format
argument addedformat
argument added
TODO:
|
…messages, enhanced string log level parser, tested --format flag
…g custom` needs tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did not have a close look at everything:
- the
env_reporter.nu
file - the
log.nu
module - the tests
wanted to make sure this was ok before moving too far in the PR 😉
…er.nu` contents into `log.nu
@skelly37 try to keep it not too big if possible, to make the review as easy as possible 🤞 |
Sure, you see the TODO Only last test case and self-review are left :) |
ohhh yes, great 😊 |
…eate a dummy file for this test and use `--env-config` flag for it
@amtoine I think it's ready for review. I suggest reading |
format
argument addedformat
argument added, better formatting of failed (not) equality assertions
format
argument added, better formatting of failed (not) equality assertionsformat
argument added, better formatting of failed (non) equality assertions
doing it right now... ♻️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coooool, thanks for this quite big refactoring, i think it looks better and i like the use of env variables better ✨
a few remarks
- a thread about the errors in
std log custom
- in the tests, could we have a single
now
,format-message
andrun-command
instead of duplicating them across test modules? - a thread about
logger_env_test_config.nu
we're close 🤞
crates/nu-std/tests/logger_tests/test_logger_uses_env_formatting.nu
Outdated
Show resolved
Hide resolved
Regarding the code duplication: I have moved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the code duplication: I have moved
now
andformat-message
to a separate file, but I think that the command runners differ too much to actually benefit from moving them to one place.
great that looks better 😌
i've refactored the error a tiny bit
- it's in a command so that all the same errors look the same
- it looks like the following now, instead of having all the values and tips on the same "error" line at the top
> use std
> std log custom "msg" "%MSG%" 21
Error: × Cannot deduce level prefix for given log level: 21.
╭─[entry #2:1:1]
1 │ std log custom "msg" "%MSG%" 21
· ─┬
· ╰── Invalid log level.
Available log levels in $env.LOG_LEVEL:
CRITICAL: 50
ERROR: 40
WARNING: 30
INFO: 20
DEBUG: 10
╰────
woopsie, my bad, that's a dumb error => working on it... ♻️ |
related to https://github.com/nushell/nushell/actions/runs/5163292820/jobs/9301532478 where the output error does not contain the original text. test bug introduced in edf627c.
Thanks for the patch & review, @amtoine! With my last commit I think we're ready, aren't we? 😋 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch & review, @amtoine!
anytime 😌
With my last commit I think we're ready, aren't we? yum
yeah, i think this is in good shape 😋
let's land this 🥳
Description
I have (hopefully) simplified the
log.nu
internal structure and added customizable log format for alllog
commandsUser-Facing Changes
format
argument to all log commands'
quotes, so the assertions for strings are more meaningfulTests + Formatting
After Submitting