mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 19:48:59 +02:00
* ✨ 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>
36 lines
691 B
Go
36 lines
691 B
Go
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)
|
|
}
|