mirror of
https://github.com/quexten/goldwarden.git
synced 2024-11-24 06:17:44 +03:00
23 lines
419 B
Go
23 lines
419 B
Go
|
package logging
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
|
||
|
"github.com/LlamaNite/llamalog"
|
||
|
)
|
||
|
|
||
|
type SilentWriter struct {
|
||
|
}
|
||
|
|
||
|
func (w SilentWriter) Write(p []byte) (n int, err error) {
|
||
|
return len(p), nil
|
||
|
}
|
||
|
|
||
|
func GetLogger(packageDir ...string) *llamalog.Logger {
|
||
|
if os.Getenv("GOLDWARDEN_SILENT_LOGGING") == "true" {
|
||
|
return llamalog.NewLoggerFromWriter(SilentWriter{}, packageDir...)
|
||
|
} else {
|
||
|
return llamalog.NewLogger(packageDir...)
|
||
|
}
|
||
|
}
|