DVUI

logFn

Some backends, like web, cannot use stdout and has a custom logFn to be used. Dvui apps should always prefer to use std.log over stdout to work across all backends.

The root file needs to use the App logFn function:

pub const std_options: std.Options = .{
    .logFn = dvui.App.logFn,
};

Source

Implementation

#
pub const logFn: @FieldType(std.Options, "logFn") = if (@hasDecl(dvui.backend, "logFn")) dvui.backend.logFn else std.log.defaultLog