Browse Source

Merge pull request #116 from tendermint/remove-logger-package

remove deprecated logger package
pull/1842/head
Ethan Buchman 7 years ago
committed by GitHub
parent
commit
f2bfa83b42
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 78 deletions
  1. +49
    -0
      README.md
  2. +0
    -78
      logger/log.go

+ 49
- 0
README.md View File

@ -0,0 +1,49 @@
# TMLIBS
This repo is a home for various small packages.
## autofile
Autofile is file access with automatic log rotation. A group of files is maintained and rotation happens
when the leading file gets too big. Provides a reader for reading from the file group.
## cli
CLI wraps the `cobra` and `viper` packages and handles some common elements of building a CLI like flags and env vars for the home directory and the logger.
## clist
Clist provides a linekd list that is safe for concurrent access by many readers.
## common
Common provides a hodgepodge of useful functions.
## db
DB provides a database interface and a number of implementions, including ones using an in-memory map, the filesystem directory structure,
an implemention of LevelDB in Go, and the official LevelDB in C.
## events
Events is a synchronous PubSub package.
## flowrate
Flowrate is a fork of https://github.com/mxk/go-flowrate that added a `SetREMA` method.
## log
Log is a log package structured around key-value pairs that allows logging level to be set differently for different keys.
## merkle
Merkle provides a simple static merkle tree and corresponding proofs.
## process
Process is a simple utility for spawning OS processes.
## pubsub
PubSub is an asynchronous PubSub package.

+ 0
- 78
logger/log.go View File

@ -1,78 +0,0 @@
// DEPRECATED! Use newer log package.
package logger
import (
"os"
"github.com/tendermint/log15"
. "github.com/tendermint/tmlibs/common"
)
var mainHandler log15.Handler
var bypassHandler log15.Handler
func init() {
resetWithLogLevel("debug")
}
func SetLogLevel(logLevel string) {
resetWithLogLevel(logLevel)
}
func resetWithLogLevel(logLevel string) {
// main handler
//handlers := []log15.Handler{}
mainHandler = log15.LvlFilterHandler(
getLevel(logLevel),
log15.StreamHandler(os.Stdout, log15.TerminalFormat()),
)
//handlers = append(handlers, mainHandler)
// bypass handler for not filtering on global logLevel.
bypassHandler = log15.StreamHandler(os.Stdout, log15.TerminalFormat())
//handlers = append(handlers, bypassHandler)
// By setting handlers on the root, we handle events from all loggers.
log15.Root().SetHandler(mainHandler)
}
// See go-wire/log for an example of usage.
func MainHandler() log15.Handler {
return mainHandler
}
func New(ctx ...interface{}) log15.Logger {
return NewMain(ctx...)
}
func BypassHandler() log15.Handler {
return bypassHandler
}
func NewMain(ctx ...interface{}) log15.Logger {
return log15.Root().New(ctx...)
}
func NewBypass(ctx ...interface{}) log15.Logger {
bypass := log15.New(ctx...)
bypass.SetHandler(bypassHandler)
return bypass
}
func getLevel(lvlString string) log15.Lvl {
lvl, err := log15.LvlFromString(lvlString)
if err != nil {
Exit(Fmt("Invalid log level %v: %v", lvlString, err))
}
return lvl
}
//----------------------------------------
// Exported from log15
var LvlFilterHandler = log15.LvlFilterHandler
var LvlDebug = log15.LvlDebug
var LvlInfo = log15.LvlInfo
var LvlNotice = log15.LvlNotice
var LvlWarn = log15.LvlWarn
var LvlError = log15.LvlError

Loading…
Cancel
Save