feat(zlog)!: JSON formatted logging #1

Manually merged
bitsyndicate merged 4 commits from zlog-json into main 2025-04-20 18:26:17 +00:00
Owner

At the moment, zlog only supports a single string format for logs:

LOG_LEVEL message

This PR introduces JSON logging support through the new json feature, which adds serde, serde_json, and chrono as dependencies. This enhancement allows for custom1 fields when logging and makes Zenyx's log output more searchable, as individual fields can be queried rather than relying on string searches.

Note that this is a breaking change, as both the configuration and calling convention have been modified to accommodate custom fields and their values1.


  1. Custom fields have been determined to be outside of the scope of this PR and will be added in a future PR. This also means that this is no longer a breaking change. ↩︎

At the moment, zlog only supports a single string format for logs: ``` LOG_LEVEL message ``` This PR introduces JSON logging support through the new `json` feature, which adds `serde`, `serde_json`, and `chrono` as dependencies. This enhancement allows for ~~custom~~[^1] fields when logging and makes Zenyx's log output more searchable, as individual fields can be queried rather than relying on string searches. ~~Note that this is a breaking change, as both the configuration and calling convention have been modified to accommodate custom fields and their values~~[^1]. [^1]: Custom fields have been determined to be outside of the scope of this PR and will be added in a future PR. This also means that this is no longer a breaking change.
lily self-assigned this 2025-04-19 07:16:44 +00:00
lily added this to the Zenyx project 2025-04-19 07:16:45 +00:00
lily added
Testing
Required
and removed
Testing
Not needed
labels 2025-04-19 08:22:00 +00:00
lily added 1 commit 2025-04-19 17:45:07 +00:00
feat(zlog)!: JSON logging support
Some checks failed
Build Zenyx ⚡ / 🔧 Setup Environment (push) Successful in 3m20s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Waiting to run
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Waiting to run
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Waiting to run
Build Zenyx ⚡ / 🔧 Setup Environment (pull_request) Successful in 3m20s
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Failing after 3s
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Failing after 5s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Failing after 3s
abc3a54084
lily force-pushed zlog-json from abc3a54084 to 339c9ee2c2 2025-04-19 17:48:35 +00:00 Compare
lily changed title from WIP: feat(zlog)!: json formatted logging to feat(zlog)!: json formatted logging 2025-04-19 17:53:48 +00:00
requested reviews from caznix, bitsyndicate 2025-04-19 17:54:06 +00:00
bitsyndicate force-pushed zlog-json from 339c9ee2c2 to 0d98f633a0 2025-04-19 19:37:59 +00:00 Compare
lily force-pushed zlog-json from 0d98f633a0 to 9f8633ff62 2025-04-19 19:39:28 +00:00 Compare
lily added 1 commit 2025-04-19 20:07:13 +00:00
feat(zlog): add tests
Some checks failed
Build Zenyx ⚡ / 🔧 Setup Environment (push) Failing after 52s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Has been skipped
Build Zenyx ⚡ / 🔧 Setup Environment (pull_request) Failing after 55s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Has been skipped
c8f8863940
lily changed title from feat(zlog)!: json formatted logging to feat(zlog)!: JSON formatted logging 2025-04-19 20:12:25 +00:00
bitsyndicate requested changes 2025-04-19 20:13:37 +00:00
Dismissed
src/main.rs Outdated
@ -489,1 +488,3 @@
.log_to_stdout(true)
.colored_stdout(false)
.log_to_stdout(false)
.log_use_json(true)
Owner

Can we not use json by default, it makes looking at stdout logs while developing a bit painful as color is a useful visual differentiator

Can we not use json by default, it makes looking at stdout logs while developing a bit painful as color is a useful visual differentiator
lily marked this conversation as resolved
lily added 1 commit 2025-04-19 20:16:07 +00:00
fix: use string logging by default
Some checks failed
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Has been skipped
Build Zenyx ⚡ / 🔧 Setup Environment (pull_request) Failing after 54s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Has been skipped
Build Zenyx ⚡ / 🔧 Setup Environment (push) Failing after 52s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Has been skipped
1f94471452
requested review from bitsyndicate 2025-04-19 20:16:26 +00:00
bitsyndicate approved these changes 2025-04-19 20:16:35 +00:00
Dismissed
lily added 1 commit 2025-04-19 20:39:58 +00:00
fix(zlog): remove unused LogJsonStructure struct
Some checks failed
Build Zenyx ⚡ / 🔧 Setup Environment (push) Failing after 52s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (push) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (push) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (push) Has been skipped
Build Zenyx ⚡ / 🔧 Setup Environment (pull_request) Failing after 50s
Build Zenyx ⚡ / 🏗️ Build aarch64-unknown-linux-gnu (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-unknown-linux-gnu (pull_request) Has been skipped
Build Zenyx ⚡ / 🏗️ Build x86_64-pc-windows-msvc (pull_request) Has been skipped
cb806fedfa
lily dismissed bitsyndicate's review 2025-04-19 20:39:58 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

lily 2025-04-19 20:45:54 +00:00
bitsyndicate referenced this pull request from a commit 2025-04-20 18:26:17 +00:00
bitsyndicate manually merged commit 415cc477f7 into main 2025-04-20 18:26:17 +00:00
lily referenced this pull request from a commit 2025-04-21 22:48:25 +00:00
bitsyndicate referenced this pull request from a commit 2025-04-22 18:37:26 +00:00
bitsyndicate referenced this pull request from a commit 2025-04-22 19:07:15 +00:00
bitsyndicate referenced this pull request from a commit 2025-04-22 19:59:25 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: nonsensical-dev/zenyx-engine#1
No description provided.