Packages

Burrito is our answer to the problem of distributing Elixir applications across varied environments. Turn your Elixir application into a simple, self-contained, single-file executable for MacOS, Linux, and Windows.

Current section

Files

Jump to
burrito src logger.zig
Raw

src/logger.zig

const std = @import("std");
const Io = std.Io;
pub fn query(comptime message: []const u8, args: anytype) void {
printToStdout("[?] " ++ message, args);
}
pub fn log_stderr(comptime message: []const u8, args: anytype) void {
printToStderr("[l] " ++ message ++ "\n", args);
}
pub fn info(comptime message: []const u8, args: anytype) void {
printToStdout("[i] " ++ message ++ "\n", args);
}
pub fn warn(comptime message: []const u8, args: anytype) void {
printToStderr("[w] " ++ message ++ "\n", args);
}
pub fn err(comptime message: []const u8, args: anytype) void {
printToStderr("[!] " ++ message ++ "\n", args);
}
pub fn crit(comptime message: []const u8, args: anytype) void {
printToStderr("[!!] " ++ message ++ "\n", args);
}
fn printToStdout(comptime message: []const u8, args: anytype) void {
var stdout_buf: [64]u8 = undefined;
var stdout_writer = Io.File.stdout().writer(std.Options.debug_io, &stdout_buf);
const stdout = &stdout_writer.interface;
stdout.print(message, args) catch {};
stdout.flush() catch {};
}
fn printToStderr(comptime message: []const u8, args: anytype) void {
var stderr_buf: [64]u8 = undefined;
var stderr_writer = Io.File.stderr().writer(std.Options.debug_io, &stderr_buf);
const stderr = &stderr_writer.interface;
stderr.print(message, args) catch {};
stderr.flush() catch {};
}