loggy

package
v0.0.0-...-0e76970 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright 2016 The Web BSD Hunt Authors.

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.

//////////////////////////////////////////////////////////////////////////////

TODO: High-level file comment. lightweight logging library with the ability to independently configure the output function and to dynamically enable and disable and filter up to 64 log levels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	Levels  map[string]uint64
	Enabled uint64
	Output  func(format string, v ...interface{})
}

func MustNewLogger

func MustNewLogger(levels []string, enabled []string) *Logger

like NewLogger but panic instead of returning error

func MustNewLoggerFromString

func MustNewLoggerFromString(levels []string, enabled string) *Logger

splits the enabled string at "," characters, and tries to enable each level so found, calls panic instead of returning error if any enabled levels have not been configured.

func NewLogger

func NewLogger(levels []string) (*Logger, error)

func (*Logger) Disable

func (logger *Logger) Disable(name string) error

Disable the log level with the given name

func (*Logger) Enable

func (logger *Logger) Enable(name string) error

Enable the log level with the given name

func (*Logger) Fatalf

func (logger *Logger) Fatalf(format string, v ...interface{})

API match with log.Fatalf() -- avoids level check

func (*Logger) Level

func (logger *Logger) Level(name string) (uint64, error)

Convert a name into a log level Can be used to cache level bits for later use

func (*Logger) Log

func (logger *Logger) Log(level uint64, format string, v ...interface{})

Loggy specific API, only logs if this level is enabled

func (*Logger) MustLevel

func (logger *Logger) MustLevel(name string) uint64

func (*Logger) Printf

func (logger *Logger) Printf(format string, v ...interface{})

API match with log.Printf() -- avoids level check

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL