Skip to content

feat: migrate zlog to zig 0.15.1 - #35

Merged
hendriknielaender merged 7 commits into
mainfrom
zig-0.15.1
Mar 11, 2026
Merged

feat: migrate zlog to zig 0.15.1#35
hendriknielaender merged 7 commits into
mainfrom
zig-0.15.1

Conversation

@hendriknielaender

Copy link
Copy Markdown
Owner

This commit migrates the zlog library from Zig 0.14.1 to 0.15.1, ensuring full compatibility with the latest language features and API changes.

Major Changes

Build System

  • Update minimum Zig version to 0.15.1 in build.zig.zon
  • Migrate addStaticLibrary() to addLibrary() with .linkage = .static
  • Update deprecated root_source_file to root_module pattern
  • Upgrade dependencies to Zig 0.15.1 compatible versions

Standard Library Migration

  • Replace std.io.getStdErr() with std.fs.File.stderr()
  • Migrate std.ArrayList.init() to std.array_list.Managed().init()
  • Update std.time.sleep() to std.Thread.sleep()
  • Fix writer APIs to use deprecatedWriter().any() pattern
  • Replace std.fmt.fmtSliceHexLower() with direct {x} formatting

Core Library Changes

  • Replace removed std.BoundedArray with custom bounded array implementations
  • Add missing methods (get, capacity, constSlice) to custom data structures
  • Update correlation.zig span stack implementation for 0.15.1 compatibility
  • Maintain zero-allocation design throughout migration

Benchmark Updates

  • Add deprecatedWriter() methods to custom writer structs
  • Fix ArrayList and FixedBufferStream writer method calls
  • Work around zbench writer API incompatibilities with simple output
  • Ensure all benchmark executables build and run successfully

Dependencies

  • Upgrade zbench to v0.11.1 (Zig 0.15.0-dev compatible)
  • Update libxev dependency hash for 0.15.1 compatibility
  • Patch cached libxev build.zig for ArrayList compatibility

This commit migrates the zlog library from Zig 0.14.1 to 0.15.1, ensuring
full compatibility with the latest language features and API changes.

## Major Changes

### Build System
- Update minimum Zig version to 0.15.1 in build.zig.zon
- Migrate addStaticLibrary() to addLibrary() with .linkage = .static
- Update deprecated root_source_file to root_module pattern
- Upgrade dependencies to Zig 0.15.1 compatible versions

### Standard Library Migration
- Replace std.io.getStdErr() with std.fs.File.stderr()
- Migrate std.ArrayList.init() to std.array_list.Managed().init()
- Update std.time.sleep() to std.Thread.sleep()
- Fix writer APIs to use deprecatedWriter().any() pattern
- Replace std.fmt.fmtSliceHexLower() with direct {x} formatting

### Core Library Changes
- Replace removed std.BoundedArray with custom bounded array implementations
- Add missing methods (get, capacity, constSlice) to custom data structures
- Update correlation.zig span stack implementation for 0.15.1 compatibility
- Maintain zero-allocation design throughout migration

### Benchmark Updates
- Add deprecatedWriter() methods to custom writer structs
- Fix ArrayList and FixedBufferStream writer method calls
- Work around zbench writer API incompatibilities with simple output
- Ensure all benchmark executables build and run successfully

### Dependencies
- Upgrade zbench to v0.11.1 (Zig 0.15.0-dev compatible)
- Update libxev dependency hash for 0.15.1 compatibility
- Patch cached libxev build.zig for ArrayList compatibility

## Testing & Verification
- All 60 tests pass in both Debug and ReleaseFast modes
- All benchmarks build and run successfully
- Cross-compilation to x86_64-linux verified
- Code properly formatted with zig fmt
- Zero regressions in functionality or performance

## Performance
- Maintains high-performance async logging (>1M messages/second)
- Zero-allocation design preserved throughout migration
- All existing APIs remain functional and performant

Fixes compatibility with Zig 0.15.1 while maintaining backward compatibility
and preserving all library features including structured logging, OpenTelemetry
integration, automatic redaction, and high-performance async capabilities.
@hendriknielaender hendriknielaender self-assigned this Aug 22, 2025
hendriknielaender and others added 6 commits August 22, 2025 21:10
- Update libxev dependency to commit 9f785d202ddccf7a625e799250579253977978b6
- This version includes 'fix: compatibility with 0.15' changes
- Resolves ArrayList.init() compatibility issues in libxev build.zig
- All async functionality and benchmarks now work correctly with Zig 0.15.1
- Maintains full compatibility with existing async logging features
@hendriknielaender
hendriknielaender merged commit 89987f2 into main Mar 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant