JZlog
JZlog

johmaru/JZlog

-

No dependent Simple zig logging library

0 0 0 0
5
build.zig.zon  build.zig 
View on Github  
Updated: 12:31:11 PM Tue Dec 24 2024 Size: 19KB Created: 4:22:49 PM Thu Nov 28 2024
Dependencies:
No known dependencies
zig  fetch  --save  git+https://github.com/johmaru/JZlog

JZlog

No dependent Simple zig logging library

library v 0.0.3 on zig version 0.13.0

※Version 0.0.3 linux supported

how to install

zig fetch --save https://github.com/johmaru/JZlog/archive/refs/tags/v0.0.3.zip

edit build.zig

    const jzlog_dep = b.dependency("JZlog", .{});
    const jzlog_module = jzlog_dep.module("JZlog");

    //Under
    //const exe = b.addExecutable(.{
      //  .name = "test_log",
      //  .root_source_file = b.path("src/main.zig"),
      //  .target = target,
      //  .optimize = optimize,
    // });

    exe.root_module.addImport("JZlog", jzlog_module);

main.zig

const jz_log = @import("JZlog");

how to use

    const JZlog = @import("JZlog");

    // all default
    try JZlog.init(null,.{}); 

    // If you want to choose time format (Y-M-D or Y-M-D-H-M-S), you can use LogTime enum types.
    try logger.init(.y_m_d,.{}); 

    // Include hsms
    try logger.init(.Include_h_s_m_s,{}); 
    
    // also you can chose any settings your like
     try logger.init(null,.{ .min_level = logger.LogLevel.Warning }); 




    // this is log write function
    try JZlog.log("Hello!", JZlog.LogLevel.Info); // This library supports various LogLevel types

    // this library have async function
    try logger.asyncLog("async!!", logger.LogLevel.Info);
    defer logger.shutdown();