Skip to content

Fix project to compile and enable setting V-level #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "go.uber.org/zap"
version = "1.9.1"

[prune]
go-tests = true
unused-packages = true
67 changes: 57 additions & 10 deletions glog.go
Original file line number Diff line number Diff line change
@@ -23,13 +23,51 @@ package glog
import (
"fmt"
"os"
"strconv"
"sync"

"go.uber.org/zap"
)

var verbosity Level

func init() {
verbosity.Set("10")
}

var mu sync.Mutex

// Level is a shim
type Level int32

// String is part of the flag.Value interface.
func (l *Level) String() string {
mu.Lock()
defer mu.Unlock()
return strconv.FormatInt(int64(*l), 10)
}

// Get is part of the flag.Value interface.
func (l *Level) Get() interface{} {
mu.Lock()
defer mu.Unlock()
return *l
}

// Set is part of the flag.Value interface.
// Used to set global verbosity level
func (l *Level) Set(value string) error {
v, err := strconv.ParseInt(value, 10, 32)
if err != nil {
return err
}

mu.Lock()
defer mu.Unlock()
*l = Level(v)
return nil
}

// Verbose is a shim
type Verbose bool

@@ -40,23 +78,32 @@ func Flush() {

// V is a shim
func V(level Level) Verbose {
return Verbose(zap.L().Core().Enabled(zap.DebugLevel))
isEnabled := zap.L().Core().Enabled(zap.DebugLevel)
mu.Lock()
defer mu.Unlock()
return Verbose(level <= verbosity && isEnabled)
}

// Info is a shim
func (v Verbose) Info(args ...interface{}) {
zap.S().Debug(args...)
if v {
zap.S().Debug(args...)
}
}

// Infoln is a shim
func (v Verbose) Infoln(args ...interface{}) {
s := fmt.Sprint(args)
zap.S().Debug(s, "\n")
if v {
s := fmt.Sprint(args...)
zap.S().Debug(s, "\n")
}
}

// Infof is a shim
func (v Verbose) Infof(format string, args ...interface{}) {
zap.S().Debugf(format, args...)
if v {
zap.S().Debugf(format, args...)
}
}

// Info is a shim
@@ -71,7 +118,7 @@ func InfoDepth(depth int, args ...interface{}) {

// Infoln is a shim
func Infoln(args ...interface{}) {
s := fmt.Sprint(args)
s := fmt.Sprint(args...)
zap.S().Info(s, "\n")
}

@@ -92,7 +139,7 @@ func WarningDepth(depth int, args ...interface{}) {

// Warningln is a shim
func Warningln(args ...interface{}) {
s := fmt.Sprint(args)
s := fmt.Sprint(args...)
zap.S().Warn(s, "\n")
}

@@ -113,7 +160,7 @@ func ErrorDepth(depth int, args ...interface{}) {

// Errorln is a shim
func Errorln(args ...interface{}) {
s := fmt.Sprint(args)
s := fmt.Sprint(args...)
zap.S().Error(s, "\n")
}

@@ -136,7 +183,7 @@ func FatalDepth(depth int, args ...interface{}) {

// Fatalln is a shim
func Fatalln(args ...interface{}) {
s := fmt.Sprint(args)
s := fmt.Sprint(args...)
zap.S().Error(s, "\n")
os.Exit(255)
}
@@ -161,7 +208,7 @@ func ExitDepth(depth int, args ...interface{}) {

// Exitln is a shim
func Exitln(args ...interface{}) {
s := fmt.Sprint(args)
s := fmt.Sprint(args...)
zap.S().Error(s, "\n")
os.Exit(1)
}
11 changes: 11 additions & 0 deletions vendor/go.uber.org/atomic/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions vendor/go.uber.org/atomic/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions vendor/go.uber.org/atomic/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions vendor/go.uber.org/atomic/Makefile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions vendor/go.uber.org/atomic/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

304 changes: 304 additions & 0 deletions vendor/go.uber.org/atomic/atomic.go
17 changes: 17 additions & 0 deletions vendor/go.uber.org/atomic/glide.lock
6 changes: 6 additions & 0 deletions vendor/go.uber.org/atomic/glide.yaml
51 changes: 51 additions & 0 deletions vendor/go.uber.org/atomic/string.go
15 changes: 15 additions & 0 deletions vendor/go.uber.org/multierr/.codecov.yml
1 change: 1 addition & 0 deletions vendor/go.uber.org/multierr/.gitignore
33 changes: 33 additions & 0 deletions vendor/go.uber.org/multierr/.travis.yml
28 changes: 28 additions & 0 deletions vendor/go.uber.org/multierr/CHANGELOG.md
19 changes: 19 additions & 0 deletions vendor/go.uber.org/multierr/LICENSE.txt
74 changes: 74 additions & 0 deletions vendor/go.uber.org/multierr/Makefile
23 changes: 23 additions & 0 deletions vendor/go.uber.org/multierr/README.md
401 changes: 401 additions & 0 deletions vendor/go.uber.org/multierr/error.go

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions vendor/go.uber.org/multierr/glide.lock
8 changes: 8 additions & 0 deletions vendor/go.uber.org/multierr/glide.yaml
17 changes: 17 additions & 0 deletions vendor/go.uber.org/zap/.codecov.yml
28 changes: 28 additions & 0 deletions vendor/go.uber.org/zap/.gitignore
108 changes: 108 additions & 0 deletions vendor/go.uber.org/zap/.readme.tmpl
21 changes: 21 additions & 0 deletions vendor/go.uber.org/zap/.travis.yml
305 changes: 305 additions & 0 deletions vendor/go.uber.org/zap/CHANGELOG.md
75 changes: 75 additions & 0 deletions vendor/go.uber.org/zap/CODE_OF_CONDUCT.md
81 changes: 81 additions & 0 deletions vendor/go.uber.org/zap/CONTRIBUTING.md
155 changes: 155 additions & 0 deletions vendor/go.uber.org/zap/FAQ.md
19 changes: 19 additions & 0 deletions vendor/go.uber.org/zap/LICENSE.txt
76 changes: 76 additions & 0 deletions vendor/go.uber.org/zap/Makefile
136 changes: 136 additions & 0 deletions vendor/go.uber.org/zap/README.md
320 changes: 320 additions & 0 deletions vendor/go.uber.org/zap/array.go
115 changes: 115 additions & 0 deletions vendor/go.uber.org/zap/buffer/buffer.go
49 changes: 49 additions & 0 deletions vendor/go.uber.org/zap/buffer/pool.go
17 changes: 17 additions & 0 deletions vendor/go.uber.org/zap/check_license.sh
243 changes: 243 additions & 0 deletions vendor/go.uber.org/zap/config.go
113 changes: 113 additions & 0 deletions vendor/go.uber.org/zap/doc.go
75 changes: 75 additions & 0 deletions vendor/go.uber.org/zap/encoder.go
80 changes: 80 additions & 0 deletions vendor/go.uber.org/zap/error.go
310 changes: 310 additions & 0 deletions vendor/go.uber.org/zap/field.go
Loading