Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

The logging system, when using main callbacks, doesn't display in the console on windows10. #92

@TheDWPCer

Description

@TheDWPCer

The following print systems fail to display to the console:

std.debug.print("std.debug.print", .{});
sdlLog(null, .application, .critical, "sdlLog-application");
sdlErr("sdlErr");
try sdl3.log.log("sdl3-zig-log", .{});
sdl3.c.SDL_Log("SDL_Log");

sdlLog and sdlErr are copied from "template/src/main.zig"

when running the template example on windows, everything works (the image is drawn) but nothing it printed to the console.
the code above was ran in the init function.

pub fn init(
    app_state: *?*AppState,
    args: [][*:0]u8,
) !sdl3.AppResult {
    _ = args;

    // Setup logging.
    sdl3.errors.error_callback = &sdlErr;
    sdl3.log.setAllPriorities(.info);
    sdl3.log.setLogOutputFunction(void, &sdlLog, null);

    // Logging test begin
    std.debug.print("std.debug.print", .{});
    sdlLog(null, .application, .critical, "sdlLog-application");
    sdlErr("sdlErr");
    try sdl3.log.log("sdl3-zig-log", .{});
    sdl3.c.SDL_Log("SDL_Log");
    // Logging test end

    try log_app.logInfo("Starting application...", .{});

    // Prepare app state.
    const state = try allocator.create(AppState);
    errdefer allocator.destroy(state);

    // Setup initial data.
    const window_renderer = try sdl3.render.Renderer.initWithWindow(
        "Hello SDL3",
        WINDOW_WIDTH,
        WINDOW_HEIGHT,
        .{},
    );
    errdefer window_renderer.renderer.deinit();
    errdefer window_renderer.window.deinit();
    const tree_tex = try sdl3.image.loadTextureIo(
        window_renderer.renderer,
        try sdl3.io_stream.Stream.initFromConstMem(my_image),
        true,
    );
    errdefer tree_tex.deinit();

    // Prove error handling works.
    const dummy: ?sdl3.video.Window = sdl3.video.Window.fromID(99999) catch null;
    _ = dummy;

    // Set app state.
    state.* = .{
        .window = window_renderer.window,
        .renderer = window_renderer.renderer,
        .tree_tex = tree_tex,
    };
    app_state.* = state;

    try log_app.logInfo("Finished initializing", .{});
    return .run;
}

also, "Finished initializing" and "Starting application..." fail to show too.

The following consoles I try with:
Visual Studio Code's bash (MINGW),
git bash (MINGW),
terminal's cmd,
terminal's powershell

This is only for main callbacks, logging work perfectly without them on windows10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions