feat(nix-compat): allow parsing and emitting log lines

This adds code allowing to parse (and emit) the "internal-json" log
format that Nixcpp emits.

Move the Verbosity struct from worker_protocol.rs out into
src/log/mod.rs, it's not only used there.

Change-Id: Ia35e739c83e06080a677b576616bdd0d4a821cf4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13167
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Brian Olsen <me@griff.name>
Reviewed-by: edef <edef@edef.eu>
This commit is contained in:
Florian Klink 2025-02-20 13:51:46 +07:00 committed by flokli
parent a512f16424
commit 23a7ead71a
11 changed files with 409 additions and 64 deletions

View file

@ -4178,10 +4178,6 @@ rec {
name = "mimalloc";
packageId = "mimalloc";
}
{
name = "serde_json";
packageId = "serde_json";
}
];
features = {
"async" = [ "tokio" ];

View file

@ -5580,10 +5580,6 @@ rec {
name = "mimalloc";
packageId = "mimalloc";
}
{
name = "serde_json";
packageId = "serde_json";
}
];
features = {
"async" = [ "tokio" ];

View file

@ -2904,10 +2904,6 @@ rec {
name = "mimalloc";
packageId = "mimalloc";
}
{
name = "serde_json";
packageId = "serde_json";
}
];
features = {
"async" = [ "tokio" ];

View file

@ -2987,10 +2987,6 @@ rec {
name = "mimalloc";
packageId = "mimalloc";
}
{
name = "serde_json";
packageId = "serde_json";
}
];
features = {
"async" = [ "tokio" ];

View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "addr2line"
@ -796,6 +796,7 @@ dependencies = [
"pin-project-lite",
"serde",
"serde_json",
"serde_repr",
"sha2",
"thiserror",
"tokio",
@ -1084,6 +1085,17 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_repr"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -1189,9 +1201,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "2.0.79"
version = "2.0.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"
dependencies = [
"proc-macro2",
"quote",
@ -1212,18 +1224,18 @@ checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
[[package]]
name = "thiserror"
version = "1.0.64"
version = "2.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.64"
version = "2.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
dependencies = [
"proc-macro2",
"quote",

View file

@ -2499,6 +2499,10 @@ rec {
name = "serde_json";
packageId = "serde_json";
}
{
name = "serde_repr";
packageId = "serde_repr";
}
{
name = "sha2";
packageId = "sha2";
@ -2527,10 +2531,6 @@ rec {
name = "mimalloc";
packageId = "mimalloc";
}
{
name = "serde_json";
packageId = "serde_json";
}
];
features = {
"async" = [ "tokio" ];
@ -3304,6 +3304,31 @@ rec {
}
];
};
"serde_repr" = rec {
crateName = "serde_repr";
version = "0.1.19";
edition = "2021";
sha256 = "1sb4cplc33z86pzlx38234xr141wr3cmviqgssiadisgl8dlar3c";
procMacro = true;
authors = [
"David Tolnay <dtolnay@gmail.com>"
];
dependencies = [
{
name = "proc-macro2";
packageId = "proc-macro2";
}
{
name = "quote";
packageId = "quote";
}
{
name = "syn";
packageId = "syn";
}
];
};
"serde_urlencoded" = rec {
crateName = "serde_urlencoded";
@ -3571,9 +3596,9 @@ rec {
};
"syn" = rec {
crateName = "syn";
version = "2.0.79";
version = "2.0.87";
edition = "2021";
sha256 = "147mk4sgigmvsb9l8qzj199ygf0fgb0bphwdsghn8205pz82q4w9";
sha256 = "0bd3mfcswvn4jkrp7ich5kk58kmpph8412yxd36nsfnh8vilrai5";
authors = [
"David Tolnay <dtolnay@gmail.com>"
];
@ -3630,9 +3655,9 @@ rec {
};
"thiserror" = rec {
crateName = "thiserror";
version = "1.0.64";
version = "2.0.11";
edition = "2021";
sha256 = "114s8lmssxl0c2480s671am88vzlasbaikxbvfv8pyqrq6mzh2nm";
sha256 = "1z0649rpa8c2smzx129bz4qvxmdihj30r2km6vfpcv9yny2g4lnl";
authors = [
"David Tolnay <dtolnay@gmail.com>"
];
@ -3642,13 +3667,16 @@ rec {
packageId = "thiserror-impl";
}
];
features = {
"default" = [ "std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"thiserror-impl" = rec {
crateName = "thiserror-impl";
version = "1.0.64";
version = "2.0.11";
edition = "2021";
sha256 = "1hvzmjx9iamln854l74qyhs0jl2pg3hhqzpqm9p8gszmf9v4x408";
sha256 = "1hkkn7p2y4cxbffcrprybkj0qy1rl1r6waxmxqvr764axaxc3br6";
procMacro = true;
libName = "thiserror_impl";
authors = [