Skip to content

Commit

Permalink
Update output examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-spencer committed Nov 22, 2024
1 parent 1bfb0ad commit 6e6f823
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,71 @@ Error management for archival workflows

[docs-1]: https://pkg.go.dev/github.com/ocfl-archive/error/pkg/error#NewFactory

### Example output

Given an example error described in YAML and registered with the error factory
on startup:

```yaml
- id: "GOCFL::1"
type: "FileSystem"
weight: 20
message: "cannot access filesystem"
```
Output is structured as shown below.
#### Via the default logger
<!--markdownlint-disable-->
```log
2024/11/22 13:07:46 [FileSystem] #GOCFL::1 (/tmp/logtest/logtest.go:41): cannot access filesystem - (add)ing to GOCFL archive
```

<!--markdownlint-enable-->

#### Via zerolog

```json
{
"level": "error",
"archive": {
"id": "GOCFL::1",
"type": "FileSystem",
"weight": 20,
"source_file": "/tmp/logtest/logtest.go:39",
"source_func": "main.main",
"message": "cannot access filesystem",
"additional": "(add)ing to GOCFL archive",
"error_data": {
"message": "disk is readonly",
"stack": ""
}
},
"time": 1732277218,
"message": "An error occurred"
}
```

#### As JSON

```json
{
"id": "GOCFL::1",
"type": "FileSystem",
"weight": 20,
"source_file": "/tmp/logtest/logtest.go:36",
"source_func": "main.main",
"message": "cannot access filesystem",
"additional": "(add)ing to GOCFL archive",
"error_data": {
"message": "disk is readonly",
"stack": ""
}
}
```

## Developer guide

### justfile
Expand Down

0 comments on commit 6e6f823

Please sign in to comment.