diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig index 47992af..a413fba 100644 --- a/src/main.zig +++ b/src/main.zig @@ -6,6 +6,8 @@ const yazap = @import("yazap"); const Message = zits.MessageParser.Message; const Server = zits.Server; +const serverSubcommand = @import("./subcommand/server.zig").main; + pub fn main() !void { var dba: std.heap.DebugAllocator(.{}) = .init; defer _ = dba.deinit(); @@ -67,7 +69,7 @@ pub fn main() !void { info.server_name = name; } - try @import("./server/main.zig").main(gpa, info); + try serverSubcommand(gpa, info); return; } else if (matches.subcommandMatches("pub")) |_| { std.debug.print("Unimplemented\n", .{}); @@ -76,3 +78,25 @@ pub fn main() !void { try app.displayHelp(io); } + +pub const std_options: std.Options = .{ + // By default, in safe build modes, the standard library will attach a segfault handler to the program to + // print a helpful stack trace if a segmentation fault occurs. Here, we can disable this, or even enable + // it in unsafe build modes. + .enable_segfault_handler = true, + // This is the logging function used by `std.log`. + .logFn = myLogFn, +}; + +fn myLogFn( + comptime level: std.log.Level, + comptime scope: @EnumLiteral(), + comptime format: []const u8, + args: anytype, +) void { + if (scope == .zits) { + std.log.defaultLog(level, std.log.default_log_scope, format, args); + } else { + std.log.defaultLog(level, scope, format, args); + } +} |
