mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-22 06:18:51 +00:00
Export logging levels from logger
by defining functions
This commit is contained in:
parent
4f760ada79
commit
e554e40f4a
@ -12,10 +12,8 @@ require (
|
||||
github.com/go-playground/validator/v10 v10.5.0
|
||||
github.com/google/martian v2.1.0+incompatible
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
|
||||
github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/romana/rlog v0.0.0-20171115192701-f018bc92e7d7
|
||||
github.com/up9inc/mizu/shared v0.0.0
|
||||
github.com/up9inc/mizu/tap v0.0.0
|
||||
github.com/up9inc/mizu/tap/api v0.0.0
|
||||
|
@ -258,7 +258,6 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
|
||||
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/romana/rlog v0.0.0-20171115192701-f018bc92e7d7 h1:jkvpcEatpwuMF5O5LVxTnehj6YZ/aEZN4NWD/Xml4pI=
|
||||
github.com/romana/rlog v0.0.0-20171115192701-f018bc92e7d7/go.mod h1:KTrHyWpO1sevuXPZwyeZc72ddWRFqNSKDFl7uVWKpg0=
|
||||
github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
"github.com/gin-contrib/static"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/op/go-logging"
|
||||
"github.com/up9inc/mizu/shared"
|
||||
"github.com/up9inc/mizu/shared/logger"
|
||||
"github.com/up9inc/mizu/tap"
|
||||
@ -41,10 +40,10 @@ var extensions []*tapApi.Extension // global
|
||||
var extensionsMap map[string]*tapApi.Extension // global
|
||||
|
||||
func main() {
|
||||
logLevel := logging.INFO
|
||||
logLevel := logger.GetInfoLevel()
|
||||
debugMode := os.Getenv(shared.DebugModeEnvVar) == "1"
|
||||
if debugMode {
|
||||
logLevel = logging.DEBUG
|
||||
logLevel = logger.GetDebugLevel()
|
||||
}
|
||||
logger.InitLoggerStderrOnly(logLevel)
|
||||
flag.Parse()
|
||||
|
@ -36,3 +36,27 @@ func InitLoggerStderrOnly(level logging.Level) {
|
||||
logging.SetBackend(backendFormatter)
|
||||
logging.SetLevel(level, "")
|
||||
}
|
||||
|
||||
func GetCriticialLevel() (level logging.Level) {
|
||||
return logging.CRITICAL
|
||||
}
|
||||
|
||||
func GetErrorLevel() (level logging.Level) {
|
||||
return logging.ERROR
|
||||
}
|
||||
|
||||
func GetWarningLevel() (level logging.Level) {
|
||||
return logging.WARNING
|
||||
}
|
||||
|
||||
func GetNoticeLevel() (level logging.Level) {
|
||||
return logging.NOTICE
|
||||
}
|
||||
|
||||
func GetInfoLevel() (level logging.Level) {
|
||||
return logging.INFO
|
||||
}
|
||||
|
||||
func GetDebugLevel() (level logging.Level) {
|
||||
return logging.DEBUG
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user