mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 11:38:59 +02:00
✨ add one instance of cache for all the service (#19)
* ✨ add one instance of cache for all the service * 🐛 fix the healthy issue * 🐛 fix lint * 🍱 upgrade codebase * 🍱 fix lint * 🐛 when there is master node shut down * Set live mode as default, clean docker and recipes * Restore live mode in readme as default * 🍱 add channel management * 🍱 order funcs * 🍱 revert service in docker compose * ✨ logLevel added + cache put out the bouncer * 🍱 fix * 🍱 fix * 🍱 fix Co-authored-by: MathieuHa <mathieu@hanotaux.fr>
This commit is contained in:
co-authored by
MathieuHa
parent
f22fc2cd09
commit
8696501f61
@@ -0,0 +1,35 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
loggerInfo = log.New(io.Discard, "INFO: CrowdsecBouncerTraefikPlugin: ", log.Ldate|log.Ltime)
|
||||
loggerDebug = log.New(io.Discard, "DEBUG: CrowdsecBouncerTraefikPlugin: ", log.Ldate|log.Ltime)
|
||||
)
|
||||
|
||||
// Init Set Default log level to info in case log level to defined
|
||||
func Init(logLevel string) {
|
||||
switch logLevel {
|
||||
case "INFO":
|
||||
loggerInfo.SetOutput(os.Stdout)
|
||||
case "DEBUG":
|
||||
loggerInfo.SetOutput(os.Stdout)
|
||||
loggerDebug.SetOutput(os.Stdout)
|
||||
default:
|
||||
loggerInfo.SetOutput(os.Stdout)
|
||||
}
|
||||
}
|
||||
|
||||
// Info Log info
|
||||
func Info(str string) {
|
||||
loggerInfo.Printf(str)
|
||||
}
|
||||
|
||||
// Info Log debug
|
||||
func Debug(str string) {
|
||||
loggerDebug.Printf(str)
|
||||
}
|
||||
Reference in New Issue
Block a user