main: kludge logrus formatter into hclog a bit more

This commit is contained in:
Michael Aldridge 2022-08-27 16:33:10 -05:00
parent 506466c01d
commit 3d431cbdf1

View file

@ -1,7 +1,6 @@
package main package main
import ( import (
"log"
"os" "os"
"os/signal" "os/signal"
"strings" "strings"
@ -11,6 +10,7 @@ import (
"github.com/netauth/ldap/internal/ldap" "github.com/netauth/ldap/internal/ldap"
"github.com/netauth/netauth/pkg/netauth" "github.com/netauth/netauth/pkg/netauth"
"github.com/spf13/viper" "github.com/spf13/viper"
log "github.com/sirupsen/logrus"
) )
func init() { func init() {
@ -36,6 +36,9 @@ func main() {
// Take over the built in logger and set it up for Trace level // Take over the built in logger and set it up for Trace level
// priority. The only thing that logs at this priority are // priority. The only thing that logs at this priority are
// protocol messages from the underlying ldap server mux. // protocol messages from the underlying ldap server mux.
log.SetFormatter(&log.TextFormatter{
DisableTimestamp: true,
})
log.SetOutput(appLogger.Named("ldap.protocol"). log.SetOutput(appLogger.Named("ldap.protocol").
StandardWriter( StandardWriter(
&hclog.StandardLoggerOptions{ &hclog.StandardLoggerOptions{
@ -43,8 +46,6 @@ func main() {
}, },
), ),
) )
log.SetPrefix("")
log.SetFlags(0)
viper.SetConfigName("config") viper.SetConfigName("config")
viper.AddConfigPath("/etc/netauth/") viper.AddConfigPath("/etc/netauth/")