add commented log function that will write to file

This commit is contained in:
Emil Lerch 2022-01-06 14:01:20 -08:00
parent 88cfd0901a
commit 2a0719853e
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -2,6 +2,41 @@ const builtin = @import("builtin");
const std = @import("std");
const Clipboard = @import("clipboard.zig");
// Define root.log to override the std implementation
// pub fn log(
// comptime level: std.log.Level,
// comptime scope: @TypeOf(.EnumLiteral),
// comptime format: []const u8,
// args: anytype,
// ) void {
// // Ignore all non-error logging from sources other than
// // .my_project, .nice_library and .default
// const scope_prefix = "(" ++ switch (scope) {
// .my_project, .nice_library, .default => @tagName(scope),
// else => if (@enumToInt(level) <= @enumToInt(std.log.Level.err))
// @tagName(scope)
// else
// return,
// } ++ "): ";
//
// const prefix = "[" ++ level.asText() ++ "] " ++ scope_prefix;
//
// // Print the message a file
// const lfile = std.fs.openFileAbsolute("d:\\yo", std.fs.File.OpenFlags{
// .read = false,
// .write = true,
// }) catch return;
// lfile.seekFromEnd(0) catch return;
// defer lfile.close();
//
// // Print the message to stderr, silently ignoring any errors
// std.debug.getStderrMutex().lock();
// defer std.debug.getStderrMutex().unlock();
// const stderr = std.io.getStdErr().writer();
// nosuspend lfile.writer().print(prefix ++ format ++ "\n", args) catch return;
// nosuspend stderr.print(prefix ++ format ++ "\n", args) catch return;
// }
pub fn main() !u8 {
var watch = false;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};