Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 22 17:36
    dpc commented #246
  • Nov 22 12:15
    Diggsey opened #246
  • Nov 06 18:27

    dpc on master

    Add Clone derive to NeverStruct Add test for Clone derive on Ne… (compare)

  • Nov 06 18:27
    dpc closed #245
  • Nov 06 18:27
    dpc closed #244
  • Nov 06 18:07
    david-mcgillicuddy-moixa synchronize #245
  • Nov 06 17:47
    david-mcgillicuddy-moixa synchronize #245
  • Nov 06 17:37
    dpc commented #245
  • Nov 06 17:35
    david-mcgillicuddy-moixa commented #245
  • Nov 06 17:25
    david-mcgillicuddy-moixa opened #245
  • Nov 06 17:20
    dpc commented #244
  • Nov 06 17:01
    david-mcgillicuddy-moixa opened #244
  • Nov 04 17:13
    Travis slog-rs/term (master) passed (1173)
  • Nov 03 17:08
    Travis slog-rs/term (master) errored (1172)
  • Oct 29 18:03
    dpc commented #237
  • Oct 28 17:35

    dpc on master

    Implement a #? pretty-debug tag… (compare)

  • Oct 28 17:35
    dpc closed #243
  • Oct 28 07:17
    BourgondAries opened #243
  • Oct 27 05:13
    elpiel closed #242
  • Oct 26 07:06
    Travis slog-rs/term (v2.4.2) passed (1162)
Kevin R. S.
@BourgondAries
Is there a ?# for pretty debugging a value?
matrixbot
@matrixbot
dpc async for slog does not seem to make a lot of sense. There's an open issue about it.
fdubois1
@fdubois1
@dpc slog-stdlog did the trick. Thanks. One more question : Before, I had the file name, the crate name and the line displayed. Is it possible to have it ? And finally, how can I get log from only some crates ? For example, I want to get log from my dependencies written by me, but not from tokio or other crate... I saw the filter, but do I have to filter base on the file name for example ? Is there a better way ?
matrixbot
@matrixbot
dpc Filter based on module.
Kevin R. S.
@BourgondAries
Will slog-rs/slog#237 be merged soon?
fdubois1
@fdubois1
@dpc , I hadn't seen the module, it is what I needed. But the only thing that is missing for now is how to add the file name, the module and the line on each log ?
Thanks a lot
matrixbot
@matrixbot
dpc They are added automatically.
dpc Each Record has them.
fdubois1
@fdubois1
@dpc Hi, thanks in advance for your help. Since we moved to slog, I don't have any log when my application is running in a docker container. Do you have an idea why I can't get logs when I run in docker ? We used to get log directly with docker logs ContainerName, but now, nothing. We are sending our log to the stdout so it should be present in docker logs. Anyway, if you have an idea, please let me know, it would be very helpful. Thanks
matrixbot
@matrixbot
dpc Do you get logs when you run the app without the docker?
dpc Also, try to start the app with exec -it /bin/bash and starting it manually -t gives you a real TTY, which might make a difference. Maybe something is failing silently due to lack of TTY (which is how normally stuff in containers run).
fdubois1
@fdubois1
@dpc Yes, if I run outside docker, I get logs. I will check that, thank you !
matrixbot
@matrixbot
dpc Are you using slog-term?
fdubois1
@fdubois1
yes, we are using slog-term... looking at it, thanks
matrixbot
@matrixbot
Waelwindows
@Waelwindows
Hello, i'm currently writing a library and I would like to add logging capabilities to it.
How should I go around to do that?
Having looked at the example, I don't have a main struct like the example
So how should i approach logging ?
specifically i'd like to use logging for my tests too
matrixbot
@matrixbot
dpc I actually don't know how are people doing it. I'd look around for projects that have slog as dev-dependency.
dpc My guess is lazy_static! and initialize a logger that you'd use in tests?
Michal 'vorner' Vaner
@vorner
In projects where I used slog, I had a function creating a dummy logger and passing it anywhere I needed. But it was only to plug the parameter, it didn't actually log. You could create whatever logger, though, so you could log too.
Waelwindows
@Waelwindows
My use case is logging for parsing, which ideally wouldn't need any other arguments than the input
the log crate is better in this sense, since i don't have to pass by a Logger, and i could choose which logger in the test/application
however I am inclined to try out slog and see how it compares
matrixbot
@matrixbot
dpc Someone had a crate for slog in tests, IIRC.
Erlend Langseth
@Ploppz
pub fn create_logger(level: slog::Level) -> slog::Logger {
    let decorator = slog_term::TermDecorator::new().build();
    let drain = slog_term::FullFormat::new(decorator).build().fuse();
    let drain = slog_async::Async::new(drain).build().fuse();
    let drain = slog::Filter::new(drain, move |record: &slog::Record| {
        record.level().is_at_least(level)
    })
    .fuse();
    slog::Logger::root(drain, o!())
}
with slog::Level::Trace, when I write trace!(log, .. it doesn't log anything, but it does log Debug and up
Denis Lisov
@tanriol
A matter of configuration, see docs
Erlend Langseth
@Ploppz
thanks!
next how can I change that logger to not be async?
Erlend Langseth
@Ploppz
nvm, PlainSyncDecorator is the answer
matrixbot
@matrixbot
dpc Duplicate it :)
Mite Ristovski
@miterst
Hello, is there a way to add the record.location().file and line to the terminal format with slog-term or I need to implement my own CustomFormat similar to the one of FullFormat?
matrixbot
@matrixbot

dpc > <@gitter_miterst:matrix.org> Hello, is there a way to add the record.location().file and line to the terminal format with slog-term or I need to implement my own CustomFormat similar to the one of FullFormat?

You could just add a custom key-value using FnValue. But if you really need it in the format, then you either submit a backward-compat PR that would make that possible, or implement custom format yourself.

Erlend Langseth
@Ploppz
when I write outputs of a logger to a file, will log entries appear in the file immediately, or is this only guaranteed when the file closes? Because my application has logged some entries to file but I expected more
Christopher Jefferson
@ChrisJefferson
I've been reading https://docs.rs/slog/2.5.2/slog/ , which links to various pages, but I can't find an actual, short guide to show how to do just... do some logging, in my program :) Is there a quick guide to the minimum I need to do to start logging?
(I don't want to come across as sounding bad, but I will say my first experiences on the doc page aren't good, "where to start" starts by telling me how to make my own drain and.. I don't really want to do that yet, unless I really have to??)
matrixbot
@matrixbot

dpc > <@gitter_chrisjefferson:matrix.org> (I don't want to come across as sounding bad, but I will say my first experiences on the doc page aren't good, "where to start" starts by telling me how to make my own drain and.. I don't really want to do that yet, unless I really have to??)

https://github.com/slog-rs/slog/tree/master/examples ?

dpc > <@gitter_ploppz:matrix.org> when I write outputs of a logger to a file, will log entries appear in the file immediately, or is this only guaranteed when the file closes? Because my application has logged some entries to file but I expected more

At least slog-term does flush after every request. https://github.com/slog-rs/term/blob/5c0316f9b0c121096d71ec43c869eaff50f0e161/src/lib.rs#L995

dpc slog-async can add some delays though, though generally not long.
Christopher Jefferson
@ChrisJefferson
@dpc : Maybe the Examples & Help should be moved higher up, maybe put it just after, or maybe even before, Features? I'll be honest, I read through features (which linked to something marked "examples how to use in a library", then working my way through the code in "Where to Start", and somewhere in "Change logging level at runtime" I decided I was too confused.
matrixbot
@matrixbot
Ekleog Hmm… Is there any way of deriving KV for structs, where every member is public? Having to duplicate every field makes me think I'll necessarily forget at least one.
matrixbot
@matrixbot
dpc There might have been a derive-KV crate somewhere...

dpc > <@leo:gaspard.ninja> Hmm… Is there any way of deriving KV for structs, where every member is public? Having to duplicate every field makes me think I'll necessarily forget at least one.

https://crates.io/search?q=slog%20derive

dpc My heart is melting seeing people building all these tools. :)
matrixbot
@matrixbot
Ekleog Great, thanks!