standard library: add log commands#8448
Conversation
|
this looks cool 😮 👍 however i'm not sure how to run this 🤔 like could you explain a bit more how to run your example above? 😋 i check the source code as soon as i can run you log commands 😌 |
|
Sorry, I just left the |
no worries,
i does not want to work it appears 😮 you can see this recording to see what happens, following your instructions 😌 i might be missing something dumb, but i think i follow exactly what you gave me! |
It is broken (no longer supported?) with Nushell 0.77
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8448 +/- ##
==========================================
- Coverage 68.52% 68.43% -0.09%
==========================================
Files 621 621
Lines 100124 99958 -166
==========================================
- Hits 68608 68408 -200
- Misses 31516 31550 +34 |
|
Thank you very much for the recording. It helped me a lot. Now it should work. (It seems that the |
|
Please note that it also can be used within pipelines |
|
Are we ready to land this one? |
coool that works now 🥳
and that is really nice to be able to do that 👌 |
|
i'll just have a quick look at the source code, but i think we're very close 💪 |
amtoine
left a comment
There was a problem hiding this comment.
only minor things for the most part.
however i have a problem 🤔
i've had a look at your tests and they look to cover the things we expect from the logger 👍
the thing is they do not run properly 😮
use crates/nu-utils/standard_library/test_logger.nu
test_logger test_critical
test_logger test_error
test_logger test_warn
test_logger test_info
test_logger test_debuggives me
CRIT test message
Error: nu::shell::only_supports_this_input_type
× Input type not supported.
╭─[crates/nu-utils/standard_library/test_logger.nu:8:1]
8 │ def "assert message" [level_str: string, output:string] {
9 │ assert ($output | str contains $level_str)
· ───┬─── ──────┬─────
· │ ╰── only string input data is supported
· ╰── input type: nothing
10 │ assert ($output | str contains "test message")
╰────i think this might need to be fixed before merging, right? 😋
|
If it's OK, I would like to rebase and use |
|
Do you want me to put log commands to |
|
@presidento - In order to distribute these files in the next release (hopefully) we'll need all of our file inside of std.nu all working harmoniously together. |
|
@fdncred 🙌 Thank you for having auto-distributed standard library so quickly. I merged main to this branch and moved log commands to |
There was a problem hiding this comment.
thanks for the doc, for the fixes and for putting this in std.nu, saves a bit of work 😌
i still have an issue with the tests however...
>_ rm crates/nu-utils/standard_library/test_std.nu # temporary command, see warning below
>_ rm crates/nu-utils/standard_library/test_dirs.nu # temporary command, see warning below
>_ nu crates/nu-utils/standard_library/tests.nu
INFO Run tests in test_logger module
Error:
× Assertion failed.
╭─[/home/amtoine/.local/share/git/store/github.com/amtoine/nushell/crates/nu-utils/standard_library/test_logger.nu:7:1]
7 │ let output = (run $system_level $message_level)
8 │ assert ($output == "")
· ───────┬───────
· ╰── It is not true.
9 │ }
╰────
Warning
thetest_dirsandtest_stddo not pass on the latestmain, so i had to remove these test modules
HOWEVER, this does NOT have anything to do with this PR, i think it can be saved for later 😉
|
It works for me for nu v0.77 and 0.76. I assume #8504 will solve this, as well. I changed assertion to have better message. |
it does not solve it... however, i trust you! not sure what to do 🤔
@fdncred |
|
ummm, tell me how to test it and i'll see what happens for me |
checkout on the PR branch and run you should have no error |
|
@amtoine This is what I get |
|
Oh, sorry. I'll fix it.
|
Chdir to the folder of std.nu, since it must be run as an external command, so the usual import logic does not work.
|
I'm sorry for the additional work. Asserting for the output of |
|
I resolved the conflicts in |
|
I'm not sure what's going on but I can't get it to work This is the version I'm using (latest main branch)
|
|
oh, i bet it's because i have nushell installed with |
|
This PR has nothing about |
|
@presidento I'm just running this `nu crates/nu-utils/standard_library/tests.nu it fails the same as above. the tests.nu script is iterating through all tests. If there's some specific command you want me to run, please let me know what it is. |
|
on the >_ nu crates/nu-utils/standard_library/tests.nu
INFO Run tests in test_dirs module
INFO Run tests in test_logger module
INFO Run tests in test_std moduleif you tell me that's expected, i'll approve this PR 👌 |
|
Yes, that is expected. You can run it with |
amtoine
left a comment
There was a problem hiding this comment.
Yes, that is expected. You can run it with
NU_LOG_LEVEL=DEBUG nu crates\nu-utils\standard_library\tests.nuto see the debug logs, I updated the README, too.
oooooh yes, that is really nice 😮
fantastic, thanks and let's land this i think 🥳
|
Looks good, works for me. Thanks! |

Description
Tests + Formatting
Tests are written. To run automatically, #8443 needs to be merged before or after this PR.