Skip to content
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

Change logger names to identify them on Kibana #321

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions poc-cb-net/cmd/admin-web/admin-web.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
// CBLogger represents a logger to show execution processes according to the logging level.
var CBLogger *logrus.Logger
var config model.Config
var loggerName = "cb-network-admin-web"

// gRPC client
var cladnetClient pb.CloudAdaptiveNetworkServiceClient
Expand All @@ -49,7 +50,7 @@ func init() {
if env != "" {
// Load cb-log config from the environment variable path (default)
fmt.Printf("CBLOG_ROOT: %v\n", env)
CBLogger = cblog.GetLogger("cb-network")
CBLogger = cblog.GetLogger(loggerName)
} else {

// Load cb-log config from the current directory (usually for the production)
Expand All @@ -63,14 +64,14 @@ func init() {
logConfPath := filepath.Join(exePath, "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)

} else {
// Load cb-log config from the project directory (usually for development)
logConfPath = filepath.Join(exePath, "..", "..", "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)
} else {
err := errors.New("fail to load log_conf.yaml")
panic(err)
Expand Down
7 changes: 4 additions & 3 deletions poc-cb-net/cmd/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var CBNet *cbnet.CBNetwork
// CBLogger represents a logger to show execution processes according to the logging level.
var CBLogger *logrus.Logger
var config model.Config
var loggerName = "cb-network-agent"

func init() {
fmt.Println("\nStart......... init() of agent.go")
Expand All @@ -44,7 +45,7 @@ func init() {
if env != "" {
// Load cb-log config from the environment variable path (default)
fmt.Printf("CBLOG_ROOT: %v\n", env)
CBLogger = cblog.GetLogger("cb-network")
CBLogger = cblog.GetLogger(loggerName)
} else {

// Load cb-log config from the current directory (usually for the production)
Expand All @@ -58,14 +59,14 @@ func init() {
logConfPath := filepath.Join(exePath, "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)

} else {
// Load cb-log config from the project directory (usually for development)
logConfPath = filepath.Join(exePath, "..", "..", "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)
} else {
err := errors.New("fail to load log_conf.yaml")
panic(err)
Expand Down
7 changes: 4 additions & 3 deletions poc-cb-net/cmd/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
// CBLogger represents a logger to show execution processes according to the logging level.
var CBLogger *logrus.Logger
var config model.Config
var loggerName = "cb-network-controller"

func init() {
fmt.Println("\nStart......... init() of controller.go")
Expand All @@ -37,7 +38,7 @@ func init() {
if env != "" {
// Load cb-log config from the environment variable path (default)
fmt.Printf("CBLOG_ROOT: %v\n", env)
CBLogger = cblog.GetLogger("cb-network")
CBLogger = cblog.GetLogger(loggerName)
} else {

// Load cb-log config from the current directory (usually for the production)
Expand All @@ -51,14 +52,14 @@ func init() {
logConfPath := filepath.Join(exePath, "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)

} else {
// Load cb-log config from the project directory (usually for development)
logConfPath = filepath.Join(exePath, "..", "..", "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)
} else {
err := errors.New("fail to load log_conf.yaml")
panic(err)
Expand Down
7 changes: 4 additions & 3 deletions poc-cb-net/cmd/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
var CBLogger *logrus.Logger
var config model.Config
var etcdClient *clientv3.Client
var loggerName = "cb-network-service"

func init() {
fmt.Println("\nStart......... init() of cb-network service.go")
Expand All @@ -55,7 +56,7 @@ func init() {
if env != "" {
// Load cb-log config from the environment variable path (default)
fmt.Printf("CBLOG_ROOT: %v\n", env)
CBLogger = cblog.GetLogger("cb-network")
CBLogger = cblog.GetLogger(loggerName)
} else {

// Load cb-log config from the current directory (usually for the production)
Expand All @@ -69,14 +70,14 @@ func init() {
logConfPath := filepath.Join(exePath, "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)

} else {
// Load cb-log config from the project directory (usually for development)
logConfPath = filepath.Join(exePath, "..", "..", "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)
} else {
err := errors.New("fail to load log_conf.yaml")
panic(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (

// CBLogger represents a logger to show execution processes according to the logging level.
var CBLogger *logrus.Logger
var loggerName="perf-eval-client"

// CB-Tumblebug
var endpointTB = "localhost:1323"
Expand Down Expand Up @@ -81,7 +82,7 @@ func init() {
if env != "" {
// Load cb-log config from the environment variable path (default)
fmt.Printf("CBLOG_ROOT: %v\n", env)
CBLogger = cblog.GetLogger("cb-network")
CBLogger = cblog.GetLogger(loggerName)
} else {

// Load cb-log config from the current directory (usually for the production)
Expand All @@ -95,14 +96,14 @@ func init() {
logConfPath := filepath.Join(exePath, "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)

} else {
// Load cb-log config from the project directory (usually for development)
logConfPath = filepath.Join(exePath, "..", "..", "..", "config", "log_conf.yaml")
if file.Exists(logConfPath) {
fmt.Printf("path of log_conf.yaml: %v\n", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath("cb-network", logConfPath)
CBLogger = cblog.GetLoggerWithConfigPath(loggerName, logConfPath)
} else {
err := errors.New("fail to load log_conf.yaml")
panic(err)
Expand Down