-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Arrobo, Gabriel <[email protected]>
- Loading branch information
1 parent
eb5e87c
commit c0be0a0
Showing
40 changed files
with
550 additions
and
643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
.coverage/ | ||
*.pyc | ||
*.swp | ||
*.log | ||
output | ||
dpdk-devbind.py | ||
dpdk-hugepages.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.4.2-dev | ||
1.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// SPDX-FileCopyrightText: 2024 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package logger | ||
|
||
import ( | ||
"go.uber.org/zap" | ||
"go.uber.org/zap/zapcore" | ||
) | ||
|
||
var ( | ||
log *zap.Logger | ||
BessLog *zap.SugaredLogger | ||
DockerLog *zap.SugaredLogger | ||
InitLog *zap.SugaredLogger | ||
P4Log *zap.SugaredLogger | ||
PfcpLog *zap.SugaredLogger | ||
atomicLevel zap.AtomicLevel | ||
) | ||
|
||
func init() { | ||
atomicLevel = zap.NewAtomicLevelAt(zap.InfoLevel) | ||
config := zap.Config{ | ||
Level: atomicLevel, | ||
Development: false, | ||
Encoding: "console", | ||
EncoderConfig: zap.NewProductionEncoderConfig(), | ||
OutputPaths: []string{"stdout"}, | ||
ErrorOutputPaths: []string{"stderr"}, | ||
} | ||
|
||
config.EncoderConfig.TimeKey = "timestamp" | ||
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder | ||
config.EncoderConfig.LevelKey = "level" | ||
config.EncoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder | ||
config.EncoderConfig.CallerKey = "caller" | ||
config.EncoderConfig.EncodeCaller = zapcore.ShortCallerEncoder | ||
config.EncoderConfig.MessageKey = "message" | ||
config.EncoderConfig.StacktraceKey = "" | ||
|
||
var err error | ||
log, err = config.Build() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
BessLog = log.Sugar().With("component", "UPF", "category", "BESS") | ||
DockerLog = log.Sugar().With("component", "UPF", "category", "Docker") | ||
InitLog = log.Sugar().With("component", "UPF", "category", "Init") | ||
P4Log = log.Sugar().With("component", "UPF", "category", "P4") | ||
PfcpLog = log.Sugar().With("component", "UPF", "category", "Pfcp") | ||
} | ||
|
||
func GetLogger() *zap.Logger { | ||
return log | ||
} | ||
|
||
// SetLogLevel: set the log level (panic|fatal|error|warn|info|debug) | ||
func SetLogLevel(level zapcore.Level) { | ||
InitLog.Infoln("set log level:", level) | ||
atomicLevel.SetLevel(level) | ||
} |
Oops, something went wrong.