Log now print always the same length
When printing 12:03 it was 12;3 before, now it's fix and use the DateTime.format function
This commit is contained in:
parent
34688a0180
commit
c7d7a01fa8
@ -135,7 +135,11 @@ pub const FileEngine = struct {
|
||||
const now = DateTime.now();
|
||||
|
||||
// TODO: Use a format to add the 0 to be 00:00 and not 0:0
|
||||
writer.print("Time: {d}/{d}/{d}-{d}:{d}:{d}.{d} - ", .{ now.years, now.months, now.days, now.hours, now.minutes, now.seconds, now.ms }) catch return;
|
||||
var date_format_buffer = std.ArrayList(u8).init(self.allocator);
|
||||
defer date_format_buffer.deinit();
|
||||
|
||||
now.format("YYYY/MM/DD-HH:mm:ss.SSSS", date_format_buffer.writer()) catch return;
|
||||
writer.print("Time: {s} - ", .{date_format_buffer.items}) catch return;
|
||||
switch (level) {
|
||||
.Debug => writer.print("Debug - ", .{}) catch return,
|
||||
.Info => writer.print("Info - ", .{}) catch return,
|
||||
|
@ -237,9 +237,7 @@ pub const DateTime = struct {
|
||||
}
|
||||
|
||||
/// fmt is based on https://momentjs.com/docs/#/displaying/format/
|
||||
pub fn format(self: Self, comptime fmt: string, options: std.fmt.FormatOptions, writer: anytype) !void {
|
||||
_ = options;
|
||||
|
||||
pub fn format(self: Self, comptime fmt: string, writer: anytype) !void {
|
||||
if (fmt.len == 0) @compileError("DateTime: format string can't be empty");
|
||||
|
||||
@setEvalBranchQuota(100000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user