authorgravatar for heidezomp@protonmail.comheidezomp <heidezomp@protonmail.com> 2020-07-22 23:26:41+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-07-22 22:08:08+00:00
log32a6759a7ae532742198bb1d257250f196916a75
tree2b147eae8dbf2e310b16cad6b42259bcb3561736
parenta6626802f9ee080616064aff0bc3f0f2709488c3

Fix std.log example to make the log handler print the newline

Follow up from #5910

1 files changed, 4 insertions(+), 4 deletions(-)

lib/std/log.zig+4-4
...@@ -40,15 +40,15 @@ const root = @import("root");...@@ -40,15 +40,15 @@ const root = @import("root");
40//! const held = std.debug.getStderrMutex().acquire();40//! const held = std.debug.getStderrMutex().acquire();
41//! defer held.release();41//! defer held.release();
42//! const stderr = std.io.getStdErr().writer();42//! const stderr = std.io.getStdErr().writer();
43//! nosuspend stderr.print(prefix ++ format, args) catch return;43//! nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return;
44//! }44//! }
45//!45//!
46//! pub fn main() void {46//! pub fn main() void {
47//! // Won't be printed as log_level is .warn47//! // Won't be printed as log_level is .warn
48//! std.log.info(.my_project, "Starting up.\n", .{});48//! std.log.info(.my_project, "Starting up.", .{});
49//! std.log.err(.nice_library, "Something went very wrong, sorry.\n", .{});49//! std.log.err(.nice_library, "Something went very wrong, sorry.", .{});
50//! // Won't be printed as it gets filtered out by our log function50//! // Won't be printed as it gets filtered out by our log function
51//! std.log.err(.lib_that_logs_too_much, "Added 1 + 1\n", .{});51//! std.log.err(.lib_that_logs_too_much, "Added 1 + 1", .{});
52//! }52//! }
53//! ```53//! ```
54//! Which produces the following output:54//! Which produces the following output: