fix: allow duplicate logview.init calls
This commit is contained in:
parent
4df737e78f
commit
042b2f330d
1 changed files with 2 additions and 2 deletions
|
@ -97,7 +97,7 @@ pub fn process_log(m: tp.message) !void {
|
||||||
const err_stop = "error.Stop";
|
const err_stop = "error.Stop";
|
||||||
if (eql(u8, msg, err_stop))
|
if (eql(u8, msg, err_stop))
|
||||||
return;
|
return;
|
||||||
if (msg.len >= err_stop.len + 1 and eql(u8, msg[0..err_stop.len + 1], err_stop ++ "\n"))
|
if (msg.len >= err_stop.len + 1 and eql(u8, msg[0 .. err_stop.len + 1], err_stop ++ "\n"))
|
||||||
return;
|
return;
|
||||||
try append_error(buffer, src, context, msg);
|
try append_error(buffer, src, context, msg);
|
||||||
} else if (try m.match(.{ "log", tp.extract(&src), tp.more })) {
|
} else if (try m.match(.{ "log", tp.extract(&src), tp.more })) {
|
||||||
|
@ -141,6 +141,6 @@ fn get_buffer() *Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init(a: Allocator) void {
|
pub fn init(a: Allocator) void {
|
||||||
if (persistent_buffer) |_| @panic("logview.init unexpected call");
|
if (persistent_buffer) |_| return;
|
||||||
persistent_buffer = Buffer.init(a);
|
persistent_buffer = Buffer.init(a);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue