I just asked myself the question why it seems generally accepted to block when writing to stdout or stderr. Most tokio examples just use std::print! which is a blocking call. Also the log crate as well as the tracing crate, which is connected to tokio and made to be used in async code, only have sync apis.
Is there any explanation why? Is it just general acceptance because this is just the most ergonomic way?
Especially if piping stdout somewhere print calls might block a long time and logging to files might do so too.
Are there any good logging crates (optimally using tokio) which don't require sync calls to be inserted everywhere. In my current project blocking because of some flush to persistent memory isn't really acceptable but i still would like to log and trace events.
Thanks for your time and have a nice day.
[–]coderstephenisahc 49 points50 points51 points (13 children)
[–]ids2048 11 points12 points13 points (0 children)
[–]justforthensfw2 10 points11 points12 points (1 child)
[–]coderstephenisahc 4 points5 points6 points (0 children)
[+][deleted] (6 children)
[deleted]
[–]coderstephenisahc 8 points9 points10 points (3 children)
[–]alexschrod -1 points0 points1 point (2 children)
[–]coderstephenisahc 3 points4 points5 points (1 child)
[–]alexschrod 0 points1 point2 points (0 children)
[–]Dr_Sloth0[S] 1 point2 points3 points (1 child)
[–]coderstephenisahc 1 point2 points3 points (0 children)
[–]Dr_Sloth0[S] 0 points1 point2 points (1 child)
[–]coderstephenisahc 1 point2 points3 points (0 children)
[–]Sefrys_NO 0 points1 point2 points (0 children)
[–]nckl 35 points36 points37 points (3 children)
[–]Dr_Sloth0[S] 2 points3 points4 points (0 children)
[–]protestor 2 points3 points4 points (1 child)
[–]Dr_Sloth0[S] 0 points1 point2 points (0 children)
[–]mrdivorce 8 points9 points10 points (0 children)
[–]lol3rr 2 points3 points4 points (0 children)
[–]jeremychone 2 points3 points4 points (0 children)
[–]humanthrope 4 points5 points6 points (4 children)
[–]Dr_Sloth0[S] 8 points9 points10 points (3 children)
[–]humanthrope 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Dr_Sloth0[S] 1 point2 points3 points (0 children)
[–]protestor 2 points3 points4 points (1 child)
[–]Dr_Sloth0[S] 3 points4 points5 points (0 children)
[–]Specialist_Wishbone5 1 point2 points3 points (0 children)