Categorygithub.com/seekerror/logw
modulepackage
0.8.1
Repository: https://github.com/seekerror/logw.git
Documentation: pkg.go.dev

# README

logw

Build Status

Logw is a build-time log wrapper over glog and AppEngine logging. It is not a logging framework intended to be extensible and flexible, but rather to allow Go libraries to log easily in multiple environments for a few fixed choices of logging mechanisms.

Usage

Simply call any logging or assert function:

logw.Printf(ctx, "Message")
logw.Warningf(ctx, "Message: %v", 3)

logw.Assert(ctx, p > 5, "Value too small")

Note that for AppEngine, the request context should be used:

ctx := appengine.NewContext(r)

License

Logw is released under the MIT License.

# Functions

Assert asserts that the predicate is true and logw.Fatals/panics otherwise.
AssertNil asserts that the err is nil and logw.Fatals/panics otherwise.
Debugf formats and logs a debug message if debug logging is enabled.
Errorf formats and logs an error message.
Exitf formats and logs an error message and halts execution is some fashion.
FatalDepthf formats and logs an error message -- using the source information from 'depth' up the call stack -- and halts execution is some fashion.
Fatalf formats and logs an error message and halts execution is some fashion.
Infof formats and logs an info message.
Warningf formats and logs a warning message.