mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 15:14:08 +00:00
added facilio logging functions
This commit is contained in:
parent
348473fcb5
commit
503554d649
3 changed files with 23 additions and 3 deletions
|
@ -1,11 +1,11 @@
|
|||
.{
|
||||
.name = "zap",
|
||||
.version = "0.0.2",
|
||||
.version = "0.0.3",
|
||||
|
||||
.dependencies = .{
|
||||
.@"facil.io" = .{
|
||||
.url = "https://github.com/zigzap/facil.io/archive/6b19a580df3cf1baeac47b369823c5a3e22c660c.tar.gz",
|
||||
.hash = "122025ad890e99fc225fd9bbd9fba6d8dacf7f0aec23e4a32a9b0a205de894ffe1f5",
|
||||
.url = "https://github.com/zigzap/facil.io/archive/3eaa3f5b99b52b71b4417887ae4cc90969705375.tar.gz",
|
||||
.hash = "122056df3447d08179bd0160b0c3776f7bef6182d80ffd01955020cbae5f7305a9cc",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,10 @@ pub fn main() !void {
|
|||
zap.enableDebugLog();
|
||||
zap.debug("ZAP debug logging is on\n", .{});
|
||||
|
||||
// we can also use facilio logging
|
||||
zap.Log.fio_set_log_level(zap.Log.fio_log_level_debug);
|
||||
zap.Log.fio_log_debug("ZAP debug logging is on\n");
|
||||
|
||||
std.debug.print("Listening on 0.0.0.0:3000\n", .{});
|
||||
|
||||
// start worker threads
|
||||
|
|
16
src/log.zig
16
src/log.zig
|
@ -15,6 +15,22 @@ pub fn log(self: *const Self, comptime fmt: []const u8, args: anytype) void {
|
|||
std.debug.print("[zap] - " ++ fmt, args);
|
||||
}
|
||||
}
|
||||
|
||||
pub extern const fio_log_level_none: c_int;
|
||||
pub extern const fio_log_level_fatal: c_int;
|
||||
pub extern const fio_log_level_error: c_int;
|
||||
pub extern const fio_log_level_warning: c_int;
|
||||
pub extern const fio_log_level_info: c_int;
|
||||
pub extern const fio_log_level_debug: c_int;
|
||||
pub extern fn fio_set_log_level(level: c_int) void;
|
||||
pub extern fn fio_get_log_level() c_int;
|
||||
pub extern fn fio_log_print(level: c_int, msg: [*c]const u8) void;
|
||||
pub extern fn fio_log_info(msg: [*c]const u8) void;
|
||||
pub extern fn fio_log_warning(msg: [*c]const u8) void;
|
||||
pub extern fn fio_log_error(msg: [*c]const u8) void;
|
||||
pub extern fn fio_log_fatal(msg: [*c]const u8) void;
|
||||
pub extern fn fio_log_debug(msg: [*c]const u8) void;
|
||||
|
||||
// pub fn getDebugLogger(comptime debug: bool) type {
|
||||
// return struct {
|
||||
// pub fn log(comptime fmt: []const u8, args: anytype) void {
|
||||
|
|
Loading…
Add table
Reference in a new issue