nanolog icon indicating copy to clipboard operation
nanolog copied to clipboard

Inflate panics: Bad file format

Open petric3 opened this issue 1 year ago • 0 comments

I need some help pls. I'm streaming data and logging it with nanolog. A bug in my code terminated the code execution, which I then restarted and naturally kept logging/append further. When I do the inflate, panics occur:

{"Name":"John","City":"SAN","t":1677767072106,"age":3,"id":127423134,"tf":5,"c":"R R","bx":"T","ax":"T","z":"A"} {"Name":"Betty","City":"DM","t":1677767072113,"age":1,"id":2423134,"tf":5,"c":"R R","bx":"P","ax":"P","z":"A"} {"Name":"John","City":"SAN","t":1677767072126,"age":3,"id":127423134,"tf":5,"c":"R R","bx":"T","ax":"T","z":"A"}panic: Bad file format

These are last three streamed messages and it seems termination append extra message/characters obscuring the json format and panics. I tried to look into the inflate code, but not much clue (ain't developer and also pretty fresh in Go). How could this be prevented in the first place if code termination happens? How can I fix the file or catch the error as the nano log file is pretty big and all is in one line?

petric3 avatar Mar 03 '23 04:03 petric3