mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
25 lines
958 B
Zig
25 lines
958 B
Zig
/// The presence of this declaration allows the program to override certain behaviors of the standard library.
|
|
/// For a full list of available options, see the documentation for `std.Options`.
|
|
pub const std_options: std.Options = .{
|
|
// By default, in safe build modes, the standard library will attach a segfault handler to the program to
|
|
// print a helpful stack trace if a segmentation fault occurs. Here, we can disable this, or even enable
|
|
// it in unsafe build modes.
|
|
.enable_segfault_handler = true,
|
|
// This is the logging function used by `std.log`.
|
|
.logFn = myLogFn,
|
|
};
|
|
|
|
fn myLogFn(
|
|
comptime level: std.log.Level,
|
|
comptime scope: @Type(.enum_literal),
|
|
comptime format: []const u8,
|
|
args: anytype,
|
|
) void {
|
|
// We could do anything we want here!
|
|
// ...but actually, let's just call the default implementation.
|
|
std.log.defaultLog(level, scope, format, args);
|
|
}
|
|
|
|
const std = @import("std");
|
|
|
|
// syntax
|