diff --git a/changelog.md b/changelog.md index 2bc78e1..7278a75 100644 --- a/changelog.md +++ b/changelog.md @@ -8,7 +8,6 @@ res/config.ini contains all of the available config options and their default va + border\_fg has been introduced to change the color of the borders. + term\_restore\_cursor\_cmd should restore the cursor to it's usual state. -+ log\_path is used to store ly.log and ly.log.old for debugging purposes (pretty much nothing is logged currently). + vi\_mode to enable vi keybindings. + sleep\_key and sleep\_cmd. @@ -43,3 +42,4 @@ session_index = 0 + X Server PID is fetched from /tmp/X{d}.lock to be able to kill the process since it detaches. + Non .desktop files are now ignored in sessions directory. + PAM auth is now done in a child process. (Fixes some issues with logging out and back in). ++ When ly receives SIGTERM, the terminal is now cleared. diff --git a/src/config/Config.zig b/src/config/Config.zig index 268c43d..0790219 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -22,7 +22,6 @@ hide_key_hints: bool = false, input_len: u8 = 34, lang: []const u8 = "en", load: bool = true, -log_path: ?[]const u8 = null, margin_box_h: u8 = 2, margin_box_v: u8 = 1, max_desktop_len: u8 = 100, diff --git a/src/logger/LogFile.zig b/src/logger/LogFile.zig deleted file mode 100644 index f93476b..0000000 --- a/src/logger/LogFile.zig +++ /dev/null @@ -1,56 +0,0 @@ -const std = @import("std"); - -const LogFile = @This(); - -file: ?std.fs.File = null, -writer: ?std.fs.File.Writer = null, -start_time: i64 = 0, - -pub fn init(log_path: ?[]const u8) LogFile { - if (log_path == null or log_path.?.len == 0) return LogFile{}; - - const directory = std.fs.openDirAbsolute(log_path.?, std.fs.Dir.OpenDirOptions{}) catch return LogFile{}; - - directory.rename("ly.log", "ly.log.old") catch |e| { - if (e != error.FileNotFound) return LogFile{}; - }; - - const createFlags = std.fs.File.CreateFlags{}; - const file = directory.createFile("ly.log", createFlags) catch return LogFile{}; - - return LogFile{ - .file = file, - .writer = file.writer(), - .start_time = std.time.milliTimestamp(), - }; -} - -pub fn deinit(self: LogFile) void { - if (self.file) |file| file.close(); -} - -fn prettyPrint(self: LogFile, comptime log_level: std.log.Level, comptime format: []const u8, args: anytype) void { - //if (comptime !std.log.logEnabled(log_level, .log_file)) return; - const ms_since_start: f80 = @floatFromInt(std.time.milliTimestamp() - self.start_time); - const log_time: f64 = @floatCast(ms_since_start / 1000); - - if (self.writer) |writer| { - writer.print("[{d:.2}s] " ++ "{s}: " ++ format ++ "\n", .{ log_time, log_level.asText() } ++ args) catch return; - } -} - -pub fn info(self: LogFile, comptime format: []const u8, args: anytype) void { - self.prettyPrint(.info, format, args); -} - -pub fn debug(self: LogFile, comptime format: []const u8, args: anytype) void { - self.prettyPrint(.debug, format, args); -} - -pub fn warn(self: LogFile, comptime format: []const u8, args: anytype) void { - self.prettyPrint(.warn, format, args); -} - -pub fn err(self: LogFile, comptime format: []const u8, args: anytype) void { - self.prettyPrint(.err, format, args); -} diff --git a/src/main.zig b/src/main.zig index 306ab17..6b1d0d1 100644 --- a/src/main.zig +++ b/src/main.zig @@ -14,7 +14,6 @@ const Config = @import("config/Config.zig"); const ini = @import("config/ini.zig"); const Lang = @import("config/Lang.zig"); const Save = @import("config/Save.zig"); -const LogFile = @import("logger/LogFile.zig"); const ViMode = @import("enums.zig").ViMode; const SharedError = @import("SharedError.zig"); @@ -91,11 +90,6 @@ pub fn main() !void { lang = lang_ini.readToStruct(lang_path) catch Lang{}; } - const logger = LogFile.init(config.log_path); - defer logger.deinit(); - - logger.debug("Ly Started", .{}); - // Initialize information line with host name var got_host_name = false; var host_name_buffer: []u8 = undefined;