Add zap logger infrastructure. #50
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Having a structure in the logs helps to highlight important data
(like errors or LSNs), especially when importing to the external log
storage.
Another long-standing addition is debug levels, allowing to distinguish
between debug and info messages.
This implementation wraps zap around our own logger module. The module
does not define an interface, as there seem no need for it, although it
would be trivial to add when necessary (i.e. if we consider plugging
another logger or use the same set of functions to pass structured error
messages up to the calling functions).
The changes also include new configuration options for backup and
restore to setup logging level, whether to show code locations in logs
and whether to enable development logging (output to console instead of
json, debug level by default and some other changes set in
zap.NewDevelopmentConfig()).
The changes does not convert existing logging solution to the new one.
This would be done after the changes in
https://github.com/ikitiki/logical_backup/commits/fixes are committed.