Skip to content

Commit

Permalink
fix: Fix logrus
Browse files Browse the repository at this point in the history
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
  • Loading branch information
cubxxw committed Apr 27, 2023
1 parent 22ed1ec commit 60d638c
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ all: tidy add-copyright lint cover build
build:
@echo "$(shell go version)"
@echo "===========> Building binary $(BUILDAPP) *[Git Info]: $(VERSION)-$(GIT_COMMIT)"
@export CGO_ENABLED=0 && go build -o $(BUILDAPP) -ldflags '-s -w' $(BUILDFILE)
@export CGO_ENABLED=0 && chmod +x ./scripts/build.sh && ./scripts/build.sh

## build.%: Builds a binary of the specified directory.
.PHONY: build.%
Expand Down
2 changes: 1 addition & 1 deletion example/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.

package log // import "github.com/kubecub/log/example"
package main // import "github.com/kubecub/log/example"
4 changes: 3 additions & 1 deletion example/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

package main

import "github.com/kubecub/log"
import (
"github.com/kubecub/log"
)

func main() {
log.Infof("this is a test log, message: %s", "good")
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,18 @@ func (l *zapLogger) Debugw(msg string, keysAndValues ...interface{}) {
l.zapLogger.Sugar().Debugw(msg, keysAndValues...)
}

`// Info method output info level log.
// ---------------------------------------------------
// Info method output info level log.
func Info(msg string, fields ...Field) {
std.zapLogger.Info(msg, fields...)
}

func (l *zapLogger) Info(msg string, fields ...Field) {
l.zapLogger.Info(msg, fields...)
}
`

// ---------------------------------------------------

// Infof method output info level log.
func Infof(format string, v ...interface{}) {
std.zapLogger.Sugar().Infof(format, v...)
Expand Down
13 changes: 10 additions & 3 deletions scripts/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ if [[ ! -d "$BIN_DIR" ]]; then
mkdir "$BIN_DIR"
fi

go build -o "$BIN_DIR/binary1" ./cmd/binary1
go build -o "$BIN_DIR/binary2" ./cmd/binary2
go build -o "$BIN_DIR/binary3" ./cmd/binary3
DIR_1="./example/example.go"
DIR_2="./example/simple/simple.go"
DIR_3="./example/context/main.go"
DIR_4="./example/vlevel/v_level.go"

printf "===========> Building binaries for %s"
go build -o "$BIN_DIR/$DIR_1" $DIR_1
go build -o "$BIN_DIR/$DIR_2" $DIR_2
go build -o "$BIN_DIR/$DIR_3" $DIR_3
go build -o "$BIN_DIR/$DIR_4" $DIR_4

0 comments on commit 60d638c

Please sign in to comment.