diff --git a/build.zig b/build.zig index 069dbc0..f5750be 100644 --- a/build.zig +++ b/build.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const logger = std.log.scoped(.builder); +const log = std.log.scoped(.builder); const builtin = @import("builtin"); const rt = @import("test/runtime_test.zig"); const RuntimeStep = rt.RuntimeStep; diff --git a/mkfat32.zig b/mkfat32.zig index 468d22b..229e23c 100644 --- a/mkfat32.zig +++ b/mkfat32.zig @@ -191,8 +191,8 @@ pub const Fat32 = struct { InvalidOptionValue, }; - /// The logger function for printing errors when creating a FAT32 image. - const logger = std.log.scoped(.mkfat32); + /// The log function for printing errors when creating a FAT32 image. + const log = std.log.scoped(.mkfat32); /// The bootloader code for the FAT32 boot sector. const bootsector_boot_code = [512]u8{ @@ -495,13 +495,13 @@ pub const Fat32 = struct { fn createFATHeader(options: Options) Error!Header { // 512 is the smallest sector size for FAT32 if (options.sector_size < 512 or options.sector_size > 4096 or options.sector_size % 512 != 0) { - logger.err("Bytes per sector is invalid. Must be greater then 512 and a multiple of 512. Found: {}", .{options.sector_size}); + log.err("Bytes per sector is invalid. Must be greater then 512 and a multiple of 512. Found: {}", .{options.sector_size}); return Error.InvalidOptionValue; } // Valid clusters are 1, 2, 4, 8, 16, 32, 64 and 128 if (options.cluster_size < 0 or options.cluster_size > 128 or !std.math.isPowerOfTwo(options.cluster_size)) { - logger.err("Sectors per cluster is invalid. Must be less then 32 and a power of 2. Found: {}", .{options.cluster_size}); + log.err("Sectors per cluster is invalid. Must be less then 32 and a power of 2. Found: {}", .{options.cluster_size}); return Error.InvalidOptionValue; } @@ -513,7 +513,7 @@ pub const Fat32 = struct { // +1 for the root director sector, 2 TB // FAT count for FAT32 is always 2 if (image_size < ((getReservedSectors() + 2 + 1) * options.sector_size) or image_size >= 2 * 1024 * 1024 * 1024 * 1024) { - logger.err("Image size is invalid. Must be greater then 17919 (~18KB). Found: {}", .{image_size}); + log.err("Image size is invalid. Must be greater then 17919 (~18KB). Found: {}", .{image_size}); return Error.InvalidOptionValue; } diff --git a/src/kernel/arch/x86/pci.zig b/src/kernel/arch/x86/pci.zig index e78247d..9e444e9 100644 --- a/src/kernel/arch/x86/pci.zig +++ b/src/kernel/arch/x86/pci.zig @@ -6,7 +6,7 @@ const build_options = @import("build_options"); const mock_path = build_options.arch_mock_path; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; -const logger = std.log.scoped(.pci); +const log = std.log.scoped(.pci); const arch = if (is_test) @import(mock_path ++ "arch_mock.zig") else @import("arch.zig"); /// The port address for selecting a 32bit register in the PCI configuration space. @@ -301,7 +301,7 @@ pub const PciDeviceInfo = struct { } pub fn print(device: arch.Device) void { - logger.info("BUS: 0x{X}, DEV: 0x{X}, FUN: 0x{X}, VID: 0x{X}, DID: 0x{X}, SC: 0x{X}, CC: 0x{X}\n", .{ + log.info("BUS: 0x{X}, DEV: 0x{X}, FUN: 0x{X}, VID: 0x{X}, DID: 0x{X}, SC: 0x{X}, CC: 0x{X}\n", .{ device.pci_device.bus, device.pci_device.device, device.function, diff --git a/src/kernel/kmain.zig b/src/kernel/kmain.zig index 9b99789..e558a14 100644 --- a/src/kernel/kmain.zig +++ b/src/kernel/kmain.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const logger = std.log.scoped(.kmain); +const kmain_log = std.log.scoped(.kmain); const builtin = @import("builtin"); const is_test = builtin.is_test; const build_options = @import("build_options"); @@ -79,9 +79,9 @@ export fn kmain(boot_payload: arch.BootPayload) void { panic_root.panic(@errorReturnTrace(), "Failed to initialise kernel VMM: {}", .{e}); }; - logger.info("Init arch " ++ @tagName(builtin.arch) ++ "\n", .{}); + kmain_log.info("Init arch " ++ @tagName(builtin.arch) ++ "\n", .{}); arch.init(&mem_profile); - logger.info("Arch init done\n", .{}); + kmain_log.info("Arch init done\n", .{}); // The VMM runtime tests can't happen until the architecture has initialised itself switch (build_options.test_mode) { @@ -137,12 +137,12 @@ export fn kmain(boot_payload: arch.BootPayload) void { }; // Initialisation is finished, now does other stuff - logger.info("Init\n", .{}); + kmain_log.info("Init\n", .{}); // Main initialisation finished so can enable interrupts arch.enableInterrupts(); - logger.info("Creating init2\n", .{}); + kmain_log.info("Creating init2\n", .{}); // Create a init2 task var stage2_task = task.Task.create(@ptrToInt(initStage2), true, kernel_vmm, &kernel_heap.allocator) catch |e| { @@ -185,7 +185,7 @@ fn initStage2() noreturn { switch (build_options.test_mode) { .Initialisation => { - logger.info("SUCCESS\n", .{}); + kmain_log.info("SUCCESS\n", .{}); }, else => {}, }