Documentation ¶
Overview ¶
Package log is a singleton package for logging either remotely or locally. If provided a host, it will connect to a service utilizing the syslogsvc protocol for tinyCI, and will alloow it to send log transmissions there.
Index ¶
- Constants
- func ConfigureRemote(addr string, cert *transport.Cert, trace bool) error
- type Client
- type FieldMap
- type Fields
- type SubLogger
- func (sub *SubLogger) Debug(ctx context.Context, msg interface{})
- func (sub *SubLogger) Debugf(ctx context.Context, msg string, values ...interface{})
- func (sub *SubLogger) Error(ctx context.Context, msg interface{})
- func (sub *SubLogger) Errorf(ctx context.Context, msg string, values ...interface{})
- func (sub *SubLogger) Info(ctx context.Context, msg interface{})
- func (sub *SubLogger) Infof(ctx context.Context, msg string, values ...interface{})
- func (sub *SubLogger) Log(ctx context.Context, level string, msg interface{}, ...)
- func (sub *SubLogger) Logf(ctx context.Context, level string, msg string, values []interface{}, ...)
- func (sub *SubLogger) WithFields(params FieldMap) *SubLogger
- func (sub *SubLogger) WithRequest(req *http.Request) *SubLogger
- func (sub *SubLogger) WithService(svc string) *SubLogger
- func (sub *SubLogger) WithUser(user *model.User) *SubLogger
Constants ¶
const ( // LevelDebug is the debug loglevel LevelDebug = "DEBUG" // LevelError is the error loglevel LevelError = "ERROR" // LevelInfo is the info loglevel LevelInfo = "INFO" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a small wrapper around the GRPC client that includes tracing data.
var ( // RemoteClient is the swagger-based syslogsvc client. RemoteClient *Client )
type FieldMap ¶
FieldMap is just a type alias for map[string]string to keep me from breaking my fingers.
type SubLogger ¶
SubLogger is a handle to cached parameters for logging.
func New ¶
func New() *SubLogger
New creates a new SubLogger which can be primed with cached values for each log entry.
func NewWithData ¶
NewWithData returns a SubLogger already primed with cached data.
func (*SubLogger) Log ¶
func (sub *SubLogger) Log(ctx context.Context, level string, msg interface{}, localLog func(...interface{}))
Log logs a thing
func (*SubLogger) Logf ¶
func (sub *SubLogger) Logf(ctx context.Context, level string, msg string, values []interface{}, localLog func(string, ...interface{}))
Logf logs a thing with formats!
func (*SubLogger) WithFields ¶
WithFields is a SubLogger version of package-level WithFields. They call the same code.
func (*SubLogger) WithRequest ¶
WithRequest is a wrapper for WithFields() that handles *http.Request data.
func (*SubLogger) WithService ¶
WithService is a SubLogger version of package-level WithService. They call the same code.