Categorygithub.com/shimmeringbee/logwrap
modulepackage
0.1.3
Repository: https://github.com/shimmeringbee/logwrap.git
Documentation: pkg.go.dev

# README

Shimmering Bee: Log Wrap

license standard-readme compliant Actions Status

Log wrapper providing syntactic sugar for structured logging, including context based persistent options and implementations for common logging systems.

Table of Contents

Background

Install

Add an import and most IDEs will go get automatically, if it doesn't go build will fetch.

import "github.com/shimmeringbee/logwrap"

Usage

This libraries API is unstable and should not yet be relied upon.

Maintainers

@pwood

Contributing

Feel free to dive in! Open an issue or submit PRs.

All Shimmering Bee projects follow the Contributor Covenant Code of Conduct.

License

Copyright 2019-2020 Shimmering Bee Contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

# Packages

No description provided by the author

# Functions

Data is an option which takes a list of options and adds them to a message.
Datum is an option which adds a single key/value to the data of the message.
Err is syntactic sugar to place errors in a messages fields.
Level is an option which sets the messages level.
New constructs a new logger, taking the backend implement which will actually log.
SequenceAsField is an option which copies the message sequence to the fields.
Source is an option to populate the source field of a message.
SourceAsField is an option which copies the message source to the fields, useful for log implementations that do not natively support source values.
SourceTrace inserts the file and line number of the file that Log was called at.
Trail builds a period delimited path, useful for assigning hierarchical identifiers to log messages.

# Constants

Debug level, verbose logging usually only needed by a operator when fault finding.
Error level, a severe issue has been encountered, but the application has recovered.
Fatal level, a severe enough issue has occurred the the application can no longer continue.
Info level, general information about the applications progress, decisions or checkpoints reached.
Panic level, the error encountered immediately panics the application.
ParentSegmentIDField is the name of the field which contains this segments parent ID.
SegmentEndValue is the value placed in the SegmentField denoting the end of a segment.
SegmentField is the name of the field which a segment will place the start and end markers in.
SegmentIDField is the name of the field which contains the segment ID.
SegmentStartValue is the value placed in the SegmentField denoting the start of a segment.
SourceTraceField is the name of the field that the SourceTrace option will place its data in.
Trace level, extreme diagnostics reporting very fine details, usually only needed by developers.
Warn level, an issue has occurred which has not caused a operational issue, but should not have happened.

# Structs

Logger is the representation of a stream of logs, it should always be instantiated with `New`.
Message structure is the struct sent to a logging implementation, it includes all fields.
SourceLocation is a representation of where the log line was called from.

# Type aliases

Impl is the interface for the actual implementation of logging to implement.
List is syntactic sugar to allow users to `Data(List{"key": "value"})`.
LogLevel is the log level type.
Option is an interface for a option a Log call can take, adding or modifying data on a Message.