From 81c15ceb348f02f33d72ffc8de1ed92c1199fe84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 4 Jan 2022 17:06:33 -0500 Subject: [PATCH] shared/log15: Remove fork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #9726 Signed-off-by: Stéphane Graber --- shared/log15/CONTRIBUTORS | 11 - shared/log15/LICENSE | 13 - shared/log15/README.md | 60 ---- shared/log15/RELEASING.md | 19 -- shared/log15/format.go | 257 ---------------- shared/log15/handler.go | 361 ----------------------- shared/log15/handler_appengine.go | 27 -- shared/log15/handler_other.go | 23 -- shared/log15/logger.go | 201 ------------- shared/log15/root.go | 67 ----- shared/log15/stack/stack.go | 225 -------------- shared/log15/stack/stack_pool.go | 20 -- shared/log15/stack/stack_pool_chan.go | 28 -- shared/log15/syslog.go | 56 ---- shared/log15/term/LICENSE | 21 -- shared/log15/term/terminal_appengine.go | 14 - shared/log15/term/terminal_darwin.go | 12 - shared/log15/term/terminal_freebsd.go | 16 - shared/log15/term/terminal_linux.go | 15 - shared/log15/term/terminal_notwindows.go | 19 -- shared/log15/term/terminal_openbsd.go | 7 - shared/log15/term/terminal_windows.go | 20 -- test/godeps.list | 2 +- test/suites/static_analysis.sh | 1 - 24 files changed, 1 insertion(+), 1494 deletions(-) delete mode 100644 shared/log15/CONTRIBUTORS delete mode 100644 shared/log15/LICENSE delete mode 100644 shared/log15/README.md delete mode 100644 shared/log15/RELEASING.md delete mode 100644 shared/log15/format.go delete mode 100644 shared/log15/handler.go delete mode 100644 shared/log15/handler_appengine.go delete mode 100644 shared/log15/handler_other.go delete mode 100644 shared/log15/logger.go delete mode 100644 shared/log15/root.go delete mode 100644 shared/log15/stack/stack.go delete mode 100644 shared/log15/stack/stack_pool.go delete mode 100644 shared/log15/stack/stack_pool_chan.go delete mode 100644 shared/log15/syslog.go delete mode 100644 shared/log15/term/LICENSE delete mode 100644 shared/log15/term/terminal_appengine.go delete mode 100644 shared/log15/term/terminal_darwin.go delete mode 100644 shared/log15/term/terminal_freebsd.go delete mode 100644 shared/log15/term/terminal_linux.go delete mode 100644 shared/log15/term/terminal_notwindows.go delete mode 100644 shared/log15/term/terminal_openbsd.go delete mode 100644 shared/log15/term/terminal_windows.go diff --git a/shared/log15/CONTRIBUTORS b/shared/log15/CONTRIBUTORS deleted file mode 100644 index a0866713be0..00000000000 --- a/shared/log15/CONTRIBUTORS +++ /dev/null @@ -1,11 +0,0 @@ -Contributors to log15: - -- Aaron L -- Alan Shreve -- Chris Hines -- Ciaran Downey -- Dmitry Chestnykh -- Evan Shaw -- Péter Szilágyi -- Trevor Gattis -- Vincent Vanackere diff --git a/shared/log15/LICENSE b/shared/log15/LICENSE deleted file mode 100644 index 5f0d1fb6a7b..00000000000 --- a/shared/log15/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2014 Alan Shreve - -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. diff --git a/shared/log15/README.md b/shared/log15/README.md deleted file mode 100644 index 49313fffafd..00000000000 --- a/shared/log15/README.md +++ /dev/null @@ -1,60 +0,0 @@ -![obligatory xkcd](http://imgs.xkcd.com/comics/standards.png) - -# log15 [![godoc reference](https://godoc.org/gopkg.in/inconshreveable/log15.v2?status.png)](https://godoc.org/gopkg.in/inconshreveable/log15.v2) - -Package log15 provides an opinionated, simple toolkit for best-practice logging in Go (golang) that is both human and machine readable. It is modeled after the Go standard library's [`io`](http://golang.org/pkg/io/) and [`net/http`](http://golang.org/pkg/net/http/) packages and is an alternative to the standard library's [`log`](http://golang.org/pkg/log/) package. - -## Features -- A simple, easy-to-understand API -- Promotes structured logging by encouraging use of key/value pairs -- Child loggers which inherit and add their own private context -- Lazy evaluation of expensive operations -- Simple Handler interface allowing for construction of flexible, custom logging configurations with a tiny API. -- Color terminal support -- Built-in support for logging to files, streams, syslog, and the network -- Support for forking records to multiple handlers, buffering records for output, failing over from failed handler writes, + more - -## Versioning -The API of the master branch of log15 should always be considered unstable. Using a stable version -of the log15 package is supported by gopkg.in. Include your dependency like so: - -```go -import log "gopkg.in/inconshreveable/log15.v2" -``` - -## Examples - -```go -// all loggers can have key/value context -srvlog := log.New("module", "app/server") - -// all log messages can have key/value context -srvlog.Warn("abnormal conn rate", "rate", curRate, "low", lowRate, "high", highRate) - -// child loggers with inherited context -connlog := srvlog.New("raddr", c.RemoteAddr()) -connlog.Info("connection open") - -// lazy evaluation -connlog.Debug("ping remote", "latency", log.Lazy(pingRemote)) - -// flexible configuration -srvlog.SetHandler(log.MultiHandler( - log.StreamHandler(os.Stderr, log.LogfmtFormat()), - log.LvlFilterHandler( - log.LvlError, - log.Must.FileHandler("errors.json", log.JsonHandler()))) -``` - -## FAQ - -### The varargs style is brittle and error prone! Can I have type safety please? -Yes. Use `log.Ctx`: - -```go -srvlog := log.New(log.Ctx{"module": "app/server"}) -srvlog.Warn("abnormal conn rate", log.Ctx{"rate": curRate, "low": lowRate, "high": highRate}) -``` - -## License -Apache diff --git a/shared/log15/RELEASING.md b/shared/log15/RELEASING.md deleted file mode 100644 index 589a4dcc618..00000000000 --- a/shared/log15/RELEASING.md +++ /dev/null @@ -1,19 +0,0 @@ -# log15's release strategy - -log15 uses gopkg.in to manage versioning releases so that consumers who don't vendor dependencies can rely upon a stable API. - -## Master - -Master is considered to have no API stability guarantee, so merging new code that passes tests into master is always okay. - -## Releasing a new API-compatible version - -The process to release a new API-compatible version is described below. For the purposes of this example, we'll assume you're trying to release a new version of v2 - -1. `git checkout v2` -1. `git merge master` -1. Audit the code for any imports of sub-packages. Modify any import references from `github.com/inconshrevealbe/log15/` -> `gopkg.in/inconshreveable/log15.v2/` -1. `git commit` -1. `git tag`, find the latest tag of the style v2.X. -1. `git tag v2.X+1` If the last version was v2.6, you would run `git tag v2.7` -1. `git push --tags git@github.com:inconshreveable/log15.git v2` diff --git a/shared/log15/format.go b/shared/log15/format.go deleted file mode 100644 index 76d260ee504..00000000000 --- a/shared/log15/format.go +++ /dev/null @@ -1,257 +0,0 @@ -package log15 - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - "strconv" - "strings" - "time" -) - -const ( - timeFormat = "2006-01-02T15:04:05-0700" - termTimeFormat = "01-02|15:04:05" - floatFormat = 'f' - termMsgJust = 40 -) - -type Format interface { - Format(r *Record) []byte -} - -// FormatFunc returns a new Format object which uses -// the given function to perform record formatting. -func FormatFunc(f func(*Record) []byte) Format { - return formatFunc(f) -} - -type formatFunc func(*Record) []byte - -func (f formatFunc) Format(r *Record) []byte { - return f(r) -} - -// TerminalFormat formats log records optimized for human readability on -// a terminal with color-coded level output and terser human friendly timestamp. -// This format should only be used for interactive programs or while developing. -// -// [TIME] [LEVEL] MESAGE key=value key=value ... -// -// Example: -// -// [May 16 20:58:45] [DBUG] remove route ns=haproxy addr=127.0.0.1:50002 -// -func TerminalFormat() Format { - return FormatFunc(func(r *Record) []byte { - var color = 0 - switch r.Lvl { - case LvlCrit: - color = 35 - case LvlError: - color = 31 - case LvlWarn: - color = 33 - case LvlInfo: - color = 32 - case LvlDebug: - color = 36 - } - - b := &bytes.Buffer{} - lvl := strings.ToUpper(r.Lvl.String()) - if color > 0 { - fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %s ", color, lvl, r.Time.Format(termTimeFormat), r.Msg) - } else { - fmt.Fprintf(b, "[%s] [%s] %s ", lvl, r.Time.Format(termTimeFormat), r.Msg) - } - - // try to justify the log output for short messages - if len(r.Ctx) > 0 && len(r.Msg) < termMsgJust { - b.Write(bytes.Repeat([]byte{' '}, termMsgJust-len(r.Msg))) - } - - // print the keys logfmt style - logfmt(b, r.Ctx, color) - return b.Bytes() - }) -} - -// LogfmtFormat prints records in logfmt format, an easy machine-parseable but human-readable -// format for key/value pairs. -// -// For more details see: http://godoc.org/github.com/kr/logfmt -// -func LogfmtFormat() Format { - return FormatFunc(func(r *Record) []byte { - common := []interface{}{r.KeyNames.Time, r.Time, r.KeyNames.Lvl, r.Lvl, r.KeyNames.Msg, r.Msg} - buf := &bytes.Buffer{} - logfmt(buf, append(common, r.Ctx...), 0) - return buf.Bytes() - }) -} - -func logfmt(buf *bytes.Buffer, ctx []interface{}, color int) { - for i := 0; i < len(ctx); i += 2 { - if i != 0 { - buf.WriteByte(' ') - } - - k, ok := ctx[i].(string) - v := formatLogfmtValue(ctx[i+1]) - if !ok { - k, v = errorKey, formatLogfmtValue(k) - } - - // XXX: we should probably check that all of your key bytes aren't invalid - if color > 0 { - fmt.Fprintf(buf, "\x1b[%dm%s\x1b[0m=%s", color, k, v) - } else { - fmt.Fprintf(buf, "%s=%s", k, v) - } - } - - buf.WriteByte('\n') -} - -// JsonFormat formats log records as JSON objects separated by newlines. -// It is the equivalent of JsonFormatEx(false, true). -func JsonFormat() Format { - return JsonFormatEx(false, true) -} - -// JsonFormatEx formats log records as JSON objects. If pretty is true, -// records will be pretty-printed. If lineSeparated is true, records -// will be logged with a new line between each record. -func JsonFormatEx(pretty, lineSeparated bool) Format { - jsonMarshal := json.Marshal - if pretty { - jsonMarshal = func(v interface{}) ([]byte, error) { - return json.MarshalIndent(v, "", " ") - } - } - - return FormatFunc(func(r *Record) []byte { - props := make(map[string]interface{}) - - props[r.KeyNames.Time] = r.Time - props[r.KeyNames.Lvl] = r.Lvl - props[r.KeyNames.Msg] = r.Msg - - for i := 0; i < len(r.Ctx); i += 2 { - k, ok := r.Ctx[i].(string) - if !ok { - props[errorKey] = fmt.Sprintf("%+v is not a string key", r.Ctx[i]) - } - props[k] = formatJsonValue(r.Ctx[i+1]) - } - - b, err := jsonMarshal(props) - if err != nil { - b, _ = jsonMarshal(map[string]string{ - errorKey: err.Error(), - }) - return b - } - - if lineSeparated { - b = append(b, '\n') - } - - return b - }) -} - -func formatShared(value interface{}) (result interface{}) { - defer func() { - if err := recover(); err != nil { - if v := reflect.ValueOf(value); v.Kind() == reflect.Ptr && v.IsNil() { - result = "nil" - } else { - panic(err) - } - } - }() - - switch v := value.(type) { - case time.Time: - return v.Format(timeFormat) - - case error: - return v.Error() - - case fmt.Stringer: - return v.String() - - default: - return v - } -} - -func formatJsonValue(value interface{}) interface{} { - value = formatShared(value) - switch value.(type) { - case int, int8, int16, int32, int64, float32, float64, uint, uint8, uint16, uint32, uint64, string: - return value - default: - return fmt.Sprintf("%+v", value) - } -} - -// formatValue formats a value for serialization -func formatLogfmtValue(value interface{}) string { - if value == nil { - return "nil" - } - - value = formatShared(value) - switch v := value.(type) { - case bool: - return strconv.FormatBool(v) - case float32: - return strconv.FormatFloat(float64(v), floatFormat, 3, 64) - case float64: - return strconv.FormatFloat(v, floatFormat, 3, 64) - case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: - return fmt.Sprintf("%d", value) - case string: - return escapeString(v) - default: - return escapeString(fmt.Sprintf("%+v", value)) - } -} - -func escapeString(s string) string { - needQuotes := false - e := bytes.Buffer{} - e.WriteByte('"') - for _, r := range s { - if r <= ' ' || r == '=' || r == '"' { - needQuotes = true - } - - switch r { - case '\\', '"': - e.WriteByte('\\') - e.WriteByte(byte(r)) - case '\n': - e.WriteByte('\\') - e.WriteByte('n') - case '\r': - e.WriteByte('\\') - e.WriteByte('r') - case '\t': - e.WriteByte('\\') - e.WriteByte('t') - default: - e.WriteRune(r) - } - } - e.WriteByte('"') - start, stop := 0, e.Len() - if !needQuotes { - start, stop = 1, stop-1 - } - return string(e.Bytes()[start:stop]) -} diff --git a/shared/log15/handler.go b/shared/log15/handler.go deleted file mode 100644 index a9efc113fc2..00000000000 --- a/shared/log15/handler.go +++ /dev/null @@ -1,361 +0,0 @@ -package log15 - -import ( - "bytes" - "fmt" - "io" - "net" - "os" - "reflect" - "sync" - - "github.com/lxc/lxd/shared/log15/stack" -) - -// A Logger prints its log records by writing to a Handler. -// The Handler interface defines where and how log records are written. -// Handlers are composable, providing you great flexibility in combining -// them to achieve the logging structure that suits your applications. -type Handler interface { - Log(r *Record) error -} - -// FuncHandler returns a Handler that logs records with the given -// function. -func FuncHandler(fn func(r *Record) error) Handler { - return funcHandler(fn) -} - -type funcHandler func(r *Record) error - -func (h funcHandler) Log(r *Record) error { - return h(r) -} - -// StreamHandler writes log records to an io.Writer -// with the given format. StreamHandler can be used -// to easily begin writing log records to other -// outputs. -// -// StreamHandler wraps itself with LazyHandler and SyncHandler -// to evaluate Lazy objects and perform safe concurrent writes. -func StreamHandler(wr io.Writer, fmtr Format) Handler { - h := FuncHandler(func(r *Record) error { - _, err := wr.Write(fmtr.Format(r)) - return err - }) - return LazyHandler(SyncHandler(h)) -} - -// SyncHandler can be wrapped around a handler to guarantee that -// only a single Log operation can proceed at a time. It's necessary -// for thread-safe concurrent writes. -func SyncHandler(h Handler) Handler { - var mu sync.Mutex - return FuncHandler(func(r *Record) error { - defer mu.Unlock() - mu.Lock() - return h.Log(r) - }) -} - -// FileHandler returns a handler which writes log records to the give file -// using the given format. If the path -// already exists, FileHandler will append to the given file. If it does not, -// FileHandler will create the file with mode 0644. -func FileHandler(path string, fmtr Format) (Handler, error) { - f, err := os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644) - if err != nil { - return nil, err - } - return closingHandler{f, StreamHandler(f, fmtr)}, nil -} - -// NetHandler opens a socket to the given address and writes records -// over the connection. -func NetHandler(network, addr string, fmtr Format) (Handler, error) { - conn, err := net.Dial(network, addr) - if err != nil { - return nil, err - } - - return closingHandler{conn, StreamHandler(conn, fmtr)}, nil -} - -// XXX: closingHandler is essentially unused at the moment -// it's meant for a future time when the Handler interface supports -// a possible Close() operation -type closingHandler struct { - io.WriteCloser - Handler -} - -func (h *closingHandler) Close() error { - return h.WriteCloser.Close() -} - -// CallerFileHandler returns a Handler that adds the line number and file of -// the calling function to the context with key "caller". -func CallerFileHandler(h Handler) Handler { - return FuncHandler(func(r *Record) error { - call := stack.Call(r.CallPC[0]) - r.Ctx = append(r.Ctx, "caller", fmt.Sprint(call)) - return h.Log(r) - }) -} - -// CallerStackHandler returns a Handler that adds a stack trace to the context -// with key "stack". The stack trace is formated as a space separated list of -// call sites inside matching []'s. The most recent call site is listed first. -// Each call site is formatted according to format. See the documentation of -// log15/stack.Call.Format for the list of supported formats. -func CallerStackHandler(format string, h Handler) Handler { - return FuncHandler(func(r *Record) error { - s := stack.Callers(). - TrimBelow(stack.Call(r.CallPC[0])). - TrimRuntime() - if len(s) > 0 { - buf := &bytes.Buffer{} - buf.WriteByte('[') - for i, pc := range s { - if i > 0 { - buf.WriteByte(' ') - } - fmt.Fprintf(buf, format, pc) - } - buf.WriteByte(']') - r.Ctx = append(r.Ctx, "stack", buf.String()) - } - return h.Log(r) - }) -} - -// FilterHandler returns a Handler that only writes records to the -// wrapped Handler if the given function evaluates true. For example, -// to only log records where the 'err' key is not nil: -// -// logger.SetHandler(FilterHandler(func(r *Record) bool { -// for i := 0; i < len(r.Ctx); i += 2 { -// if r.Ctx[i] == "err" { -// return r.Ctx[i+1] != nil -// } -// } -// return false -// }, h)) -// -func FilterHandler(fn func(r *Record) bool, h Handler) Handler { - return FuncHandler(func(r *Record) error { - if fn(r) { - return h.Log(r) - } - return nil - }) -} - -// MatchFilterHandler returns a Handler that only writes records -// to the wrapped Handler if the given key in the logged -// context matches the value. For example, to only log records -// from your ui package: -// -// log.MatchFilterHandler("pkg", "app/ui", log.StdoutHandler) -// -func MatchFilterHandler(key string, value interface{}, h Handler) Handler { - return FilterHandler(func(r *Record) (pass bool) { - switch key { - case r.KeyNames.Lvl: - return r.Lvl == value - case r.KeyNames.Time: - return r.Time == value - case r.KeyNames.Msg: - return r.Msg == value - } - - for i := 0; i < len(r.Ctx); i += 2 { - if r.Ctx[i] == key { - return r.Ctx[i+1] == value - } - } - return false - }, h) -} - -// LvlFilterHandler returns a Handler that only writes -// records which are less than the given verbosity -// level to the wrapped Handler. For example, to only -// log Error/Crit records: -// -// log.LvlFilterHandler(log.Error, log.StdoutHandler) -// -func LvlFilterHandler(maxLvl Lvl, h Handler) Handler { - return FilterHandler(func(r *Record) (pass bool) { - return r.Lvl <= maxLvl - }, h) -} - -// A MultiHandler dispatches any write to each of its handlers. -// This is useful for writing different types of log information -// to different locations. For example, to log to a file and -// standard error: -// -// log.MultiHandler( -// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()), -// log.StderrHandler) -// -func MultiHandler(hs ...Handler) Handler { - return FuncHandler(func(r *Record) error { - for _, h := range hs { - // what to do about failures? - h.Log(r) - } - return nil - }) -} - -// A FailoverHandler writes all log records to the first handler -// specified, but will failover and write to the second handler if -// the first handler has failed, and so on for all handlers specified. -// For example you might want to log to a network socket, but failover -// to writing to a file if the network fails, and then to -// standard out if the file write fails: -// -// log.FailoverHandler( -// log.Must.NetHandler("tcp", ":9090", log.JsonFormat()), -// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()), -// log.StdoutHandler) -// -// All writes that do not go to the first handler will add context with keys of -// the form "failover_err_{idx}" which explain the error encountered while -// trying to write to the handlers before them in the list. -func FailoverHandler(hs ...Handler) Handler { - return FuncHandler(func(r *Record) error { - var err error - for i, h := range hs { - err = h.Log(r) - if err == nil { - return nil - } else { - r.Ctx = append(r.Ctx, fmt.Sprintf("failover_err_%d", i), err) - } - } - - return err - }) -} - -// ChannelHandler writes all records to the given channel. -// It blocks if the channel is full. Useful for async processing -// of log messages, it's used by BufferedHandler. -func ChannelHandler(recs chan<- *Record) Handler { - return FuncHandler(func(r *Record) error { - recs <- r - return nil - }) -} - -// BufferedHandler writes all records to a buffered -// channel of the given size which flushes into the wrapped -// handler whenever it is available for writing. Since these -// writes happen asynchronously, all writes to a BufferedHandler -// never return an error and any errors from the wrapped handler are ignored. -func BufferedHandler(bufSize int, h Handler) Handler { - recs := make(chan *Record, bufSize) - go func() { - for m := range recs { - _ = h.Log(m) - } - }() - return ChannelHandler(recs) -} - -// LazyHandler writes all values to the wrapped handler after evaluating -// any lazy functions in the record's context. It is already wrapped -// around StreamHandler and SyslogHandler in this library, you'll only need -// it if you write your own Handler. -func LazyHandler(h Handler) Handler { - return FuncHandler(func(r *Record) error { - // go through the values (odd indices) and reassign - // the values of any lazy fn to the result of its execution - hadErr := false - for i := 1; i < len(r.Ctx); i += 2 { - lz, ok := r.Ctx[i].(Lazy) - if ok { - v, err := evaluateLazy(lz) - if err != nil { - hadErr = true - r.Ctx[i] = err - } else { - if cs, ok := v.(stack.Trace); ok { - v = cs.TrimBelow(stack.Call(r.CallPC[0])). - TrimRuntime() - } - r.Ctx[i] = v - } - } - } - - if hadErr { - r.Ctx = append(r.Ctx, errorKey, "bad lazy") - } - - return h.Log(r) - }) -} - -func evaluateLazy(lz Lazy) (interface{}, error) { - t := reflect.TypeOf(lz.Fn) - - if t.Kind() != reflect.Func { - return nil, fmt.Errorf("INVALID_LAZY, not func: %+v", lz.Fn) - } - - if t.NumIn() > 0 { - return nil, fmt.Errorf("INVALID_LAZY, func takes args: %+v", lz.Fn) - } - - if t.NumOut() == 0 { - return nil, fmt.Errorf("INVALID_LAZY, no func return val: %+v", lz.Fn) - } - - value := reflect.ValueOf(lz.Fn) - results := value.Call([]reflect.Value{}) - if len(results) == 1 { - return results[0].Interface(), nil - } else { - values := make([]interface{}, len(results)) - for i, v := range results { - values[i] = v.Interface() - } - return values, nil - } -} - -// DiscardHandler reports success for all writes but does nothing. -// It is useful for dynamically disabling logging at runtime via -// a Logger's SetHandler method. -func DiscardHandler() Handler { - return FuncHandler(func(r *Record) error { - return nil - }) -} - -// The Must object provides the following Handler creation functions -// which instead of returning an error parameter only return a Handler -// and panic on failure: FileHandler, NetHandler, SyslogHandler, SyslogNetHandler -var Must muster - -func must(h Handler, err error) Handler { - if err != nil { - panic(err) - } - return h -} - -type muster struct{} - -func (m muster) FileHandler(path string, fmtr Format) Handler { - return must(FileHandler(path, fmtr)) -} - -func (m muster) NetHandler(network, addr string, fmtr Format) Handler { - return must(NetHandler(network, addr, fmtr)) -} diff --git a/shared/log15/handler_appengine.go b/shared/log15/handler_appengine.go deleted file mode 100644 index 1cb04921f98..00000000000 --- a/shared/log15/handler_appengine.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build appengine -// +build appengine - -package log15 - -import "sync" - -// swapHandler wraps another handler that may be swapped out -// dynamically at runtime in a thread-safe fashion. -type swapHandler struct { - handler interface{} - lock sync.RWMutex -} - -func (h *swapHandler) Log(r *Record) error { - h.lock.RLock() - defer h.lock.RUnlock() - - return h.handler.(Handler).Log(r) -} - -func (h *swapHandler) Swap(newHandler Handler) { - h.lock.Lock() - defer h.lock.Unlock() - - h.handler = newHandler -} diff --git a/shared/log15/handler_other.go b/shared/log15/handler_other.go deleted file mode 100644 index f15ee75629d..00000000000 --- a/shared/log15/handler_other.go +++ /dev/null @@ -1,23 +0,0 @@ -//go:build !appengine -// +build !appengine - -package log15 - -import ( - "sync/atomic" - "unsafe" -) - -// swapHandler wraps another handler that may be swapped out -// dynamically at runtime in a thread-safe fashion. -type swapHandler struct { - handler unsafe.Pointer -} - -func (h *swapHandler) Log(r *Record) error { - return (*(*Handler)(atomic.LoadPointer(&h.handler))).Log(r) -} - -func (h *swapHandler) Swap(newHandler Handler) { - atomic.StorePointer(&h.handler, unsafe.Pointer(&newHandler)) -} diff --git a/shared/log15/logger.go b/shared/log15/logger.go deleted file mode 100644 index dcd7cf8dba2..00000000000 --- a/shared/log15/logger.go +++ /dev/null @@ -1,201 +0,0 @@ -package log15 - -import ( - "fmt" - "runtime" - "time" -) - -const timeKey = "t" -const lvlKey = "lvl" -const msgKey = "msg" -const errorKey = "LOG15_ERROR" - -type Lvl int - -const ( - LvlCrit Lvl = iota - LvlError - LvlWarn - LvlInfo - LvlDebug -) - -// Returns the name of a Lvl -func (l Lvl) String() string { - switch l { - case LvlDebug: - return "dbug" - case LvlInfo: - return "info" - case LvlWarn: - return "warn" - case LvlError: - return "eror" - case LvlCrit: - return "crit" - default: - panic("bad level") - } -} - -// Returns the appropriate Lvl from a string name. -// Useful for parsing command line args and configuration files. -func LvlFromString(lvlString string) (Lvl, error) { - switch lvlString { - case "debug", "dbug": - return LvlDebug, nil - case "info": - return LvlInfo, nil - case "warn": - return LvlWarn, nil - case "error", "eror": - return LvlError, nil - case "crit": - return LvlCrit, nil - default: - return LvlDebug, fmt.Errorf("Unknown level: %v", lvlString) - } -} - -// A Record is what a Logger asks its handler to write -type Record struct { - Time time.Time - Lvl Lvl - Msg string - Ctx []interface{} - CallPC [1]uintptr - KeyNames RecordKeyNames -} - -type RecordKeyNames struct { - Time string - Msg string - Lvl string -} - -// A Logger writes key/value pairs to a Handler -type Logger interface { - // New returns a new Logger that has this logger's context plus the given context - New(ctx ...interface{}) Logger - - // SetHandler updates the logger to write records to the specified handler. - SetHandler(h Handler) - - // Log a message at the given level with context key/value pairs - Debug(msg string, ctx ...interface{}) - Info(msg string, ctx ...interface{}) - Warn(msg string, ctx ...interface{}) - Error(msg string, ctx ...interface{}) - Crit(msg string, ctx ...interface{}) -} - -type logger struct { - ctx []interface{} - h *swapHandler -} - -func (l *logger) write(msg string, lvl Lvl, ctx []interface{}) { - r := Record{ - Time: time.Now(), - Lvl: lvl, - Msg: msg, - Ctx: newContext(l.ctx, ctx), - KeyNames: RecordKeyNames{ - Time: timeKey, - Msg: msgKey, - Lvl: lvlKey, - }, - } - runtime.Callers(3, r.CallPC[:]) - l.h.Log(&r) -} - -func (l *logger) New(ctx ...interface{}) Logger { - child := &logger{newContext(l.ctx, ctx), new(swapHandler)} - child.SetHandler(l.h) - return child -} - -func newContext(prefix []interface{}, suffix []interface{}) []interface{} { - normalizedSuffix := normalize(suffix) - newCtx := make([]interface{}, len(prefix)+len(normalizedSuffix)) - n := copy(newCtx, prefix) - copy(newCtx[n:], normalizedSuffix) - return newCtx -} - -func (l *logger) Debug(msg string, ctx ...interface{}) { - l.write(msg, LvlDebug, ctx) -} - -func (l *logger) Info(msg string, ctx ...interface{}) { - l.write(msg, LvlInfo, ctx) -} - -func (l *logger) Warn(msg string, ctx ...interface{}) { - l.write(msg, LvlWarn, ctx) -} - -func (l *logger) Error(msg string, ctx ...interface{}) { - l.write(msg, LvlError, ctx) -} - -func (l *logger) Crit(msg string, ctx ...interface{}) { - l.write(msg, LvlCrit, ctx) -} - -func (l *logger) SetHandler(h Handler) { - l.h.Swap(h) -} - -func normalize(ctx []interface{}) []interface{} { - // if the caller passed a Ctx object, then expand it - if len(ctx) == 1 { - if ctxMap, ok := ctx[0].(Ctx); ok { - ctx = ctxMap.toArray() - } - } - - // ctx needs to be even because it's a series of key/value pairs - // no one wants to check for errors on logging functions, - // so instead of erroring on bad input, we'll just make sure - // that things are the right length and users can fix bugs - // when they see the output looks wrong - if len(ctx)%2 != 0 { - ctx = append(ctx, nil, errorKey, "Normalized odd number of arguments by adding nil") - } - - return ctx -} - -// Lazy allows you to defer calculation of a logged value that is expensive -// to compute until it is certain that it must be evaluated with the given filters. -// -// Lazy may also be used in conjunction with a Logger's New() function -// to generate a child logger which always reports the current value of changing -// state. -// -// You may wrap any function which takes no arguments to Lazy. It may return any -// number of values of any type. -type Lazy struct { - Fn interface{} -} - -// Ctx is a map of key/value pairs to pass as context to a log function -// Use this only if you really need greater safety around the arguments you pass -// to the logging functions. -type Ctx map[string]interface{} - -func (c Ctx) toArray() []interface{} { - arr := make([]interface{}, len(c)*2) - - i := 0 - for k, v := range c { - arr[i] = k - arr[i+1] = v - i += 2 - } - - return arr -} diff --git a/shared/log15/root.go b/shared/log15/root.go deleted file mode 100644 index ed3a3cf54a0..00000000000 --- a/shared/log15/root.go +++ /dev/null @@ -1,67 +0,0 @@ -package log15 - -import ( - "os" - - "github.com/lxc/lxd/shared/log15/term" - "github.com/mattn/go-colorable" -) - -var ( - root *logger - StdoutHandler = StreamHandler(os.Stdout, LogfmtFormat()) - StderrHandler = StreamHandler(os.Stderr, LogfmtFormat()) -) - -func init() { - if term.IsTty(os.Stdout.Fd()) { - StdoutHandler = StreamHandler(colorable.NewColorableStdout(), TerminalFormat()) - } - - if term.IsTty(os.Stderr.Fd()) { - StderrHandler = StreamHandler(colorable.NewColorableStderr(), TerminalFormat()) - } - - root = &logger{[]interface{}{}, new(swapHandler)} - root.SetHandler(StdoutHandler) -} - -// New returns a new logger with the given context. -// New is a convenient alias for Root().New -func New(ctx ...interface{}) Logger { - return root.New(ctx...) -} - -// Root returns the root logger -func Root() Logger { - return root -} - -// The following functions bypass the exported logger methods (logger.Debug, -// etc.) to keep the call depth the same for all paths to logger.write so -// runtime.Caller(2) always refers to the call site in client code. - -// Debug is a convenient alias for Root().Debug -func Debug(msg string, ctx ...interface{}) { - root.write(msg, LvlDebug, ctx) -} - -// Info is a convenient alias for Root().Info -func Info(msg string, ctx ...interface{}) { - root.write(msg, LvlInfo, ctx) -} - -// Warn is a convenient alias for Root().Warn -func Warn(msg string, ctx ...interface{}) { - root.write(msg, LvlWarn, ctx) -} - -// Error is a convenient alias for Root().Error -func Error(msg string, ctx ...interface{}) { - root.write(msg, LvlError, ctx) -} - -// Crit is a convenient alias for Root().Crit -func Crit(msg string, ctx ...interface{}) { - root.write(msg, LvlCrit, ctx) -} diff --git a/shared/log15/stack/stack.go b/shared/log15/stack/stack.go deleted file mode 100644 index ae3021ccea3..00000000000 --- a/shared/log15/stack/stack.go +++ /dev/null @@ -1,225 +0,0 @@ -// Package stack implements utilities to capture, manipulate, and format call -// stacks. -package stack - -import ( - "fmt" - "path/filepath" - "runtime" - "strings" -) - -// Call records a single function invocation from a goroutine stack. It is a -// wrapper for the program counter values returned by runtime.Caller and -// runtime.Callers and consumed by runtime.FuncForPC. -type Call uintptr - -// Format implements fmt.Formatter with support for the following verbs. -// -// %s source file -// %d line number -// %n function name -// %v equivalent to %s:%d -// -// It accepts the '+' and '#' flags for most of the verbs as follows. -// -// %+s path of source file relative to the compile time GOPATH -// %#s full path of source file -// %+n import path qualified function name -// %+v equivalent to %+s:%d -// %#v equivalent to %#s:%d -func (pc Call) Format(s fmt.State, c rune) { - // BUG(ChrisHines): Subtracting one from pc is a work around for - // https://code.google.com/p/go/issues/detail?id=7690. The idea for this - // work around comes from rsc's initial patch at - // https://codereview.appspot.com/84100043/#ps20001, but as noted in the - // issue discussion, it is not a complete fix since it doesn't handle some - // cases involving signals. Just the same, it handles all of the other - // cases I have tested. - pcFix := uintptr(pc) - 1 - fn := runtime.FuncForPC(pcFix) - if fn == nil { - fmt.Fprintf(s, "%%!%c(NOFUNC)", c) - return - } - - switch c { - case 's', 'v': - file, line := fn.FileLine(pcFix) - switch { - case s.Flag('#'): - // done - case s.Flag('+'): - // Here we want to get the source file path relative to the - // compile time GOPATH. As of Go 1.3.x there is no direct way to - // know the compiled GOPATH at runtime, but we can infer the - // number of path segments in the GOPATH. We note that fn.Name() - // returns the function name qualified by the import path, which - // does not include the GOPATH. Thus we can trim segments from the - // beginning of the file path until the number of path separators - // remaining is one more than the number of path separators in the - // function name. For example, given: - // - // GOPATH /home/user - // file /home/user/src/pkg/sub/file.go - // fn.Name() pkg/sub.Type.Method - // - // We want to produce: - // - // pkg/sub/file.go - // - // From this we can easily see that fn.Name() has one less path - // separator than our desired output. - const sep = "/" - impCnt := strings.Count(fn.Name(), sep) + 1 - pathCnt := strings.Count(file, sep) - for pathCnt > impCnt { - i := strings.Index(file, sep) - if i == -1 { - break - } - file = file[i+len(sep):] - pathCnt-- - } - default: - const sep = "/" - if i := strings.LastIndex(file, sep); i != -1 { - file = file[i+len(sep):] - } - } - fmt.Fprint(s, file) - if c == 'v' { - fmt.Fprint(s, ":", line) - } - - case 'd': - _, line := fn.FileLine(pcFix) - fmt.Fprint(s, line) - - case 'n': - name := fn.Name() - if !s.Flag('+') { - const pathSep = "/" - if i := strings.LastIndex(name, pathSep); i != -1 { - name = name[i+len(pathSep):] - } - const pkgSep = "." - if i := strings.Index(name, pkgSep); i != -1 { - name = name[i+len(pkgSep):] - } - } - fmt.Fprint(s, name) - } -} - -// Callers returns a Trace for the current goroutine with element 0 -// identifying the calling function. -func Callers() Trace { - pcs := poolBuf() - pcs = pcs[:cap(pcs)] - n := runtime.Callers(2, pcs) - cs := make([]Call, n) - for i, pc := range pcs[:n] { - cs[i] = Call(pc) - } - putPoolBuf(pcs) - return cs -} - -// name returns the import path qualified name of the function containing the -// call. -func (pc Call) name() string { - pcFix := uintptr(pc) - 1 // work around for go issue #7690 - fn := runtime.FuncForPC(pcFix) - if fn == nil { - return "???" - } - return fn.Name() -} - -func (pc Call) file() string { - pcFix := uintptr(pc) - 1 // work around for go issue #7690 - fn := runtime.FuncForPC(pcFix) - if fn == nil { - return "???" - } - file, _ := fn.FileLine(pcFix) - return file -} - -// Trace records a sequence of function invocations from a goroutine stack. -type Trace []Call - -// Format implements fmt.Formatter by printing the Trace as square brackes ([, -// ]) surrounding a space separated list of Calls each formatted with the -// supplied verb and options. -func (pcs Trace) Format(s fmt.State, c rune) { - s.Write([]byte("[")) - for i, pc := range pcs { - if i > 0 { - s.Write([]byte(" ")) - } - pc.Format(s, c) - } - s.Write([]byte("]")) -} - -// TrimBelow returns a slice of the Trace with all entries below pc removed. -func (pcs Trace) TrimBelow(pc Call) Trace { - for len(pcs) > 0 && pcs[0] != pc { - pcs = pcs[1:] - } - return pcs -} - -// TrimAbove returns a slice of the Trace with all entries above pc removed. -func (pcs Trace) TrimAbove(pc Call) Trace { - for len(pcs) > 0 && pcs[len(pcs)-1] != pc { - pcs = pcs[:len(pcs)-1] - } - return pcs -} - -// TrimBelowName returns a slice of the Trace with all entries below the -// lowest with function name name removed. -func (pcs Trace) TrimBelowName(name string) Trace { - for len(pcs) > 0 && pcs[0].name() != name { - pcs = pcs[1:] - } - return pcs -} - -// TrimAboveName returns a slice of the Trace with all entries above the -// highest with function name name removed. -func (pcs Trace) TrimAboveName(name string) Trace { - for len(pcs) > 0 && pcs[len(pcs)-1].name() != name { - pcs = pcs[:len(pcs)-1] - } - return pcs -} - -var goroot string - -func init() { - goroot = filepath.ToSlash(runtime.GOROOT()) - if runtime.GOOS == "windows" { - goroot = strings.ToLower(goroot) - } -} - -func inGoroot(path string) bool { - if runtime.GOOS == "windows" { - path = strings.ToLower(path) - } - return strings.HasPrefix(path, goroot) -} - -// TrimRuntime returns a slice of the Trace with the topmost entries from the -// go runtime removed. It considers any calls originating from files under -// GOROOT as part of the runtime. -func (pcs Trace) TrimRuntime() Trace { - for len(pcs) > 0 && inGoroot(pcs[len(pcs)-1].file()) { - pcs = pcs[:len(pcs)-1] - } - return pcs -} diff --git a/shared/log15/stack/stack_pool.go b/shared/log15/stack/stack_pool.go deleted file mode 100644 index 3447ba93e33..00000000000 --- a/shared/log15/stack/stack_pool.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build go1.3 -// +build go1.3 - -package stack - -import ( - "sync" -) - -var pcStackPool = sync.Pool{ - New: func() interface{} { return make([]uintptr, 1000) }, -} - -func poolBuf() []uintptr { - return pcStackPool.Get().([]uintptr) -} - -func putPoolBuf(p []uintptr) { - pcStackPool.Put(p) -} diff --git a/shared/log15/stack/stack_pool_chan.go b/shared/log15/stack/stack_pool_chan.go deleted file mode 100644 index 84d32264ce1..00000000000 --- a/shared/log15/stack/stack_pool_chan.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build !go1.3 || appengine -// +build !go1.3 appengine - -package stack - -const ( - stackPoolSize = 64 -) - -var ( - pcStackPool = make(chan []uintptr, stackPoolSize) -) - -func poolBuf() []uintptr { - select { - case p := <-pcStackPool: - return p - default: - return make([]uintptr, 1000) - } -} - -func putPoolBuf(p []uintptr) { - select { - case pcStackPool <- p: - default: - } -} diff --git a/shared/log15/syslog.go b/shared/log15/syslog.go deleted file mode 100644 index d42c679785b..00000000000 --- a/shared/log15/syslog.go +++ /dev/null @@ -1,56 +0,0 @@ -//go:build !windows && !plan9 -// +build !windows,!plan9 - -package log15 - -import ( - "log/syslog" - "strings" -) - -// SyslogHandler opens a connection to the system syslog daemon by calling -// syslog.New and writes all records to it. -func SyslogHandler(tag string, fmtr Format) (Handler, error) { - wr, err := syslog.New(syslog.LOG_INFO, tag) - return sharedSyslog(fmtr, wr, err) -} - -// SyslogHandler opens a connection to a log daemon over the network and writes -// all log records to it. -func SyslogNetHandler(net, addr string, tag string, fmtr Format) (Handler, error) { - wr, err := syslog.Dial(net, addr, syslog.LOG_INFO, tag) - return sharedSyslog(fmtr, wr, err) -} - -func sharedSyslog(fmtr Format, sysWr *syslog.Writer, err error) (Handler, error) { - if err != nil { - return nil, err - } - h := FuncHandler(func(r *Record) error { - var syslogFn = sysWr.Info - switch r.Lvl { - case LvlCrit: - syslogFn = sysWr.Crit - case LvlError: - syslogFn = sysWr.Err - case LvlWarn: - syslogFn = sysWr.Warning - case LvlInfo: - syslogFn = sysWr.Info - case LvlDebug: - syslogFn = sysWr.Debug - } - - s := strings.TrimSpace(string(fmtr.Format(r))) - return syslogFn(s) - }) - return LazyHandler(&closingHandler{sysWr, h}), nil -} - -func (m muster) SyslogHandler(tag string, fmtr Format) Handler { - return must(SyslogHandler(tag, fmtr)) -} - -func (m muster) SyslogNetHandler(net, addr string, tag string, fmtr Format) Handler { - return must(SyslogNetHandler(net, addr, tag, fmtr)) -} diff --git a/shared/log15/term/LICENSE b/shared/log15/term/LICENSE deleted file mode 100644 index f090cb42f37..00000000000 --- a/shared/log15/term/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Simon Eskildsen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/shared/log15/term/terminal_appengine.go b/shared/log15/term/terminal_appengine.go deleted file mode 100644 index 2ab83749bd6..00000000000 --- a/shared/log15/term/terminal_appengine.go +++ /dev/null @@ -1,14 +0,0 @@ -// Based on ssh/terminal: -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build appengine -// +build appengine - -package term - -// IsTty always returns false on AppEngine. -func IsTty(fd uintptr) bool { - return false -} diff --git a/shared/log15/term/terminal_darwin.go b/shared/log15/term/terminal_darwin.go deleted file mode 100644 index f0f43237ba8..00000000000 --- a/shared/log15/term/terminal_darwin.go +++ /dev/null @@ -1,12 +0,0 @@ -// Based on ssh/terminal: -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package term - -import "golang.org/x/sys/unix" - -const ioctlReadTermios = unix.TIOCGETA - -type Termios unix.Termios diff --git a/shared/log15/term/terminal_freebsd.go b/shared/log15/term/terminal_freebsd.go deleted file mode 100644 index 9eecadd32ee..00000000000 --- a/shared/log15/term/terminal_freebsd.go +++ /dev/null @@ -1,16 +0,0 @@ -package term - -import "golang.org/x/sys/unix" - -const ioctlReadTermios = unix.TIOCGETA - -// Go 1.2 doesn't include Termios for FreeBSD. This should be added in 1.3 and this could be merged with terminal_darwin. -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} diff --git a/shared/log15/term/terminal_linux.go b/shared/log15/term/terminal_linux.go deleted file mode 100644 index e5b7ff32d55..00000000000 --- a/shared/log15/term/terminal_linux.go +++ /dev/null @@ -1,15 +0,0 @@ -// Based on ssh/terminal: -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !appengine -// +build !appengine - -package term - -import "golang.org/x/sys/unix" - -const ioctlReadTermios = unix.TCGETS - -type Termios unix.Termios diff --git a/shared/log15/term/terminal_notwindows.go b/shared/log15/term/terminal_notwindows.go deleted file mode 100644 index f124a74cfa9..00000000000 --- a/shared/log15/term/terminal_notwindows.go +++ /dev/null @@ -1,19 +0,0 @@ -// Based on ssh/terminal: -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (linux && !appengine) || darwin || freebsd || openbsd -// +build linux,!appengine darwin freebsd openbsd - -package term - -import ( - "golang.org/x/sys/unix" -) - -// IsTty returns true if the given file descriptor is a terminal. -func IsTty(fd uintptr) bool { - _, err := unix.IoctlGetTermios(int(fd), ioctlReadTermios) - return err == nil -} diff --git a/shared/log15/term/terminal_openbsd.go b/shared/log15/term/terminal_openbsd.go deleted file mode 100644 index 6a70e51b7bc..00000000000 --- a/shared/log15/term/terminal_openbsd.go +++ /dev/null @@ -1,7 +0,0 @@ -package term - -import "golang.org/x/sys/unix" - -const ioctlReadTermios = unix.TIOCGETA - -type Termios unix.Termios diff --git a/shared/log15/term/terminal_windows.go b/shared/log15/term/terminal_windows.go deleted file mode 100644 index 8a1b55cdbf5..00000000000 --- a/shared/log15/term/terminal_windows.go +++ /dev/null @@ -1,20 +0,0 @@ -// Based on ssh/terminal: -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build windows -// +build windows - -package term - -import ( - "golang.org/x/sys/windows" -) - -// IsTty returns true if the given file descriptor is a terminal. -func IsTty(fd uintptr) bool { - var mode uint32 - err := windows.GetConsoleMode(windows.Handle(fd), &mode) - return mode != 0 && err == nil -} diff --git a/test/godeps.list b/test/godeps.list index 56e5658749d..c1fc7c38166 100644 --- a/test/godeps.list +++ b/test/godeps.list @@ -5,11 +5,11 @@ github.com/lxc/lxd/shared github.com/lxc/lxd/shared/api github.com/lxc/lxd/shared/cancel github.com/lxc/lxd/shared/ioprogress -github.com/lxc/lxd/shared/log15 github.com/lxc/lxd/shared/logger github.com/lxc/lxd/shared/simplestreams github.com/lxc/lxd/shared/units github.com/pkg/errors +gopkg.in/inconshreveable/log15.v2 gopkg.in/juju/environschema.v1/form gopkg.in/macaroon-bakery.v2/bakery gopkg.in/macaroon-bakery.v2/httpbakery diff --git a/test/suites/static_analysis.sh b/test/suites/static_analysis.sh index 05e4c98852d..7ae63413d5b 100644 --- a/test/suites/static_analysis.sh +++ b/test/suites/static_analysis.sh @@ -121,7 +121,6 @@ test_static_analysis() { golint -set_exit_status shared/i18n/... # golint -set_exit_status shared/idmap/... golint -set_exit_status shared/ioprogress/... -# golint -set_exit_status shared/log15/... golint -set_exit_status shared/logger/... golint -set_exit_status shared/logging/... golint -set_exit_status shared/netutils/...