Skip to content

Commit

Permalink
Enable info logging on release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Beyley committed Oct 1, 2023
1 parent c6f2f63 commit 8f5ef25
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main.zig
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const std = @import("std");
const builtin = @import("builtin");
const Rpc = @import("rpc");

const Lbp = @import("lbp.zig");
const c = @import("c.zig").c;
const Config = @import("config.zig");

pub const std_options = struct {
pub const std_options = struct {
pub fn logFn(
comptime message_level: std.log.Level,
comptime scope: @Type(.EnumLiteral),
Expand All @@ -25,13 +26,15 @@ pub const std_options = struct {
defer std.debug.getStderrMutex().unlock();
nosuspend stderr.print("{c}" ++ color ++ level_txt ++ prefix2 ++ format ++ "{c}[0m\n", .{std.ascii.control_code.esc} ++ args ++ .{std.ascii.control_code.esc}) catch return;
}

pub const log_level = if (builtin.mode == .Debug) .debug else .info;
};

pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer if (gpa.deinit() == .leak) @panic("MEMORY LEAK");
var allocator = gpa.allocator();

runApp(allocator) catch |err| {
var text = std.ArrayList(u8).init(allocator);
defer text.deinit();
Expand Down Expand Up @@ -360,7 +363,7 @@ fn runRpcThread(rpc_client: *Rpc, app_id: []const u8) void {
c.BoxerStyleError,
c.BoxerButtonsQuit,
);

std.log.err("rpc client err: {s}", .{@errorName(err)});

err catch unreachable;
Expand Down

0 comments on commit 8f5ef25

Please sign in to comment.