Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nalchevanidze/diff_logger
Pretty diff logger for JSON values in rust
https://github.com/nalchevanidze/diff_logger
Last synced: about 12 hours ago
JSON representation
Pretty diff logger for JSON values in rust
- Host: GitHub
- URL: https://github.com/nalchevanidze/diff_logger
- Owner: nalchevanidze
- License: mit
- Created: 2023-04-07T12:09:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-04-10T21:31:52.000Z (over 1 year ago)
- Last Synced: 2024-11-06T20:52:10.467Z (1 day ago)
- Language: Rust
- Size: 99.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DiffLogger
generates a log of changes for JSON values
# Example
```rs
use diff_logger::DiffLogger;
use serde_json::json;fn main() {
let logger = DiffLogger::new().set_header("timestamp", false);let prev = json!({
"name": "David",
"age": 43,
"ver": {
"timestamp": "2023-04-07T11:17:50+00:00",
"value": "some text",
},
"state": {
"timestamp": "2023-04-07T11:17:50+00:00",
"removedField": "some text",
"valueChange": 45
},
"email": [
{ "num": "[email protected]"},
]
});let next = json!(
{
"name": "John",
"age": 35,
"state": {
"timestamp": "2023-04-07T12:17:50+00:00",
"newField": 4,
"valueChange": 42352
},
"ver": {
"timestamp": "2023-04-07T11:18:50+00:00",
"value": "some text",
},
"email": [
{ "num": "[email protected]"},
]
});println!("----------------------\n");
logger.log_diff(&prev, &next);
println!("\n----------------------");
}
```logs:
![demo](assets/demo.png)