Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flatten nested objects #114

Open
aybabtme opened this issue Oct 29, 2024 · 1 comment
Open

flatten nested objects #114

aybabtme opened this issue Oct 29, 2024 · 1 comment

Comments

@aybabtme
Copy link
Collaborator

right now, when a nested object is found in the input, it is sprintf("%v"). instead, it should be flattened out with .:

an input of

{"storage": {"from": "2024-10-29T05:47:00Z"}}

currently gets encoded in the kv as:

storage=map[from:2024-10-29T05:47:00Z]

but it should become

storage.from=2024-10-29T05:47:00Z
@aybabtme
Copy link
Collaborator Author

Another example:

input:

{"time":"2024-10-29T16:45:54.384776+09:00","level":"DEBUG","source":{"function":"github.com/humanlogio/humanlog/internal/memstorage.(*MemStorageSink).firstMatch","file":"/Users/antoine/code/src/github.com/humanlogio/humanlog/internal/memstorage/memory.go","line":243},"msg":"first match found at index","storage":{"machine.id":5089,"session.id":1730187806608637000,"i":0}}

current render (when fed into humanlog --truncate=false):

Oct 29 16:45:54 |DEBU| first match found at index storage=map[i:0 machine.id:5089 session.id:1.730187806608637e+18] source=map[file:/Users/antoine/code/src/github.com/humanlogio/humanlog/internal/memstorage/memory.go function:github.com/humanlogio/humanlog/internal/memstorage.(*MemStorageSink).firstMatch line:243]

expected render:

Oct 29 16:45:54 |DEBU| first match found at index storage.i=0 storage.machine.id=5089 storage.session.id=1.730187806608637e+18 source.file="/Users/antoine/code/src/github.com/humanlogio/humanlog/internal/memstorage/memory.go" source.function="github.com/humanlogio/humanlog/internal/memstorage.(*MemStorageSink).firstMatch" source.line=243

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

No branches or pull requests

1 participant