bump to zig 0.14.dev
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 53s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 53s
This commit is contained in:
@@ -17,7 +17,7 @@ jobs:
|
||||
- name: Setup zig installation
|
||||
uses: mlugg/setup-zig@v1
|
||||
with:
|
||||
version: 0.13.0
|
||||
version: master
|
||||
- name: Run tests
|
||||
run: zig build --release=fast
|
||||
- name: Release build artifacts
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Setup zig installation
|
||||
uses: mlugg/setup-zig@v1
|
||||
with:
|
||||
version: 0.13.0
|
||||
version: master
|
||||
- name: Lint check
|
||||
run: zig fmt --check .
|
||||
- name: Spell checking
|
||||
|
||||
@@ -89,7 +89,7 @@ This will result in the following output:
|
||||
For more details about the output customization see the configuration options of the `zlog` module. Following options are available:
|
||||
|
||||
- _timestamp_ (default: `true`): Prepend the current timestamp before each log message.
|
||||
- _stderr_ (default: `true`): Print log messages to stderr. **NOTE**: Currently not working as log output is not appended and only the last log message will be in the resulting log file! This is a not-yet-implemented feature of the standard library of zig 0.13.0! See this [issue](https://github.com/ziglang/zig/issues/14375) for more details.
|
||||
- _stderr_ (default: `true`): Print log messages to stderr. **NOTE**: Currently not working as log output is not appended and only the last log message will be in the resulting log file! This is a not-yet-implemented feature of the standard library of zig! See this [issue](https://github.com/ziglang/zig/issues/14375) for more details.
|
||||
|
||||
## Tips
|
||||
|
||||
|
||||
10
src/zlog.zig
10
src/zlog.zig
@@ -9,7 +9,7 @@ pub const std_options: std.Options = .{
|
||||
// zlog defaultLog function replacement, which adjusts the surrounding contents of every std.log message.
|
||||
fn logFn(
|
||||
comptime message_level: std.log.Level,
|
||||
comptime scope: @Type(.EnumLiteral),
|
||||
comptime scope: @Type(.enum_literal),
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
@@ -71,7 +71,7 @@ fn inner_format(object: anytype, comptime fmt: []const u8, options: std.fmt.Form
|
||||
const Object = @TypeOf(object);
|
||||
const object_info = @typeInfo(Object);
|
||||
switch (object_info) {
|
||||
.Struct => |s| {
|
||||
.@"struct" => |s| {
|
||||
try writer.writeAll(@typeName(Object));
|
||||
try writer.writeAll(" = struct {\n");
|
||||
inline for (s.fields) |field| {
|
||||
@@ -87,7 +87,7 @@ fn inner_format(object: anytype, comptime fmt: []const u8, options: std.fmt.Form
|
||||
try writer.writeAll("\t" ** depth);
|
||||
try writer.writeAll("}");
|
||||
},
|
||||
.Enum => |e| {
|
||||
.@"enum" => |e| {
|
||||
try writer.writeAll(@typeName(Object));
|
||||
try writer.writeAll(" = enum {\n");
|
||||
inline for (e.fields) |field| {
|
||||
@@ -101,14 +101,14 @@ fn inner_format(object: anytype, comptime fmt: []const u8, options: std.fmt.Form
|
||||
},
|
||||
// TODO: implement prett_printing for other user defined types (`union` and `vector`)
|
||||
// TODO: recognize []const u8 types and print them as strings
|
||||
.Array => |a| {
|
||||
.array => |a| {
|
||||
if (a.child == @TypeOf([:0]const u8)) {
|
||||
try std.fmt.format(writer, "\"{s}\"", .{object});
|
||||
} else {
|
||||
try std.fmt.format(writer, "[]{s}: {any}", .{ @typeName(a.child), object });
|
||||
}
|
||||
},
|
||||
.Vector => |v| {
|
||||
.vector => |v| {
|
||||
if (v.child == @TypeOf([:0]const u8)) {
|
||||
try std.fmt.format(writer, "\"{s}\"", .{object});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user