Improved logging configuration (#342)

This commit is contained in:
David Zhao
2022-01-15 10:28:03 -08:00
committed by GitHub
parent d45435ed3d
commit c122c98e4d
11 changed files with 139 additions and 78 deletions
+17 -15
View File
@@ -59,6 +59,11 @@ func main() {
Usage: "IP address of the current node, used to advertise to clients. Automatically determined by default",
EnvVars: []string{"NODE_IP"},
},
&cli.IntFlag{
Name: "udp-port",
Usage: "Single UDP port to use for WebRTC traffic",
EnvVars: []string{"UDP_PORT"},
},
&cli.StringFlag{
Name: "redis-host",
Usage: "host (incl. port) to redis server",
@@ -69,6 +74,17 @@ func main() {
Usage: "password to redis",
EnvVars: []string{"REDIS_PASSWORD"},
},
&cli.StringFlag{
Name: "turn-cert",
Usage: "tls cert file for TURN server",
EnvVars: []string{"LIVEKIT_TURN_CERT"},
},
&cli.StringFlag{
Name: "turn-key",
Usage: "tls key file for TURN server",
EnvVars: []string{"LIVEKIT_TURN_KEY"},
},
// debugging flags
&cli.StringFlag{
Name: "cpuprofile",
Usage: "write cpu profile to `file`",
@@ -81,16 +97,6 @@ func main() {
Name: "dev",
Usage: "sets log-level to debug, and console formatter",
},
&cli.StringFlag{
Name: "turn-cert",
Usage: "tls cert file for TURN server",
EnvVars: []string{"LIVEKIT_TURN_CERT"},
},
&cli.StringFlag{
Name: "turn-key",
Usage: "tls key file for TURN server",
EnvVars: []string{"LIVEKIT_TURN_KEY"},
},
},
Action: startServer,
Commands: []*cli.Command{
@@ -160,11 +166,7 @@ func startServer(c *cli.Context) error {
return err
}
if conf.Development {
serverlogger.InitDevelopment(conf.LogLevel)
} else {
serverlogger.InitProduction(conf.LogLevel)
}
serverlogger.InitFromConfig(conf.Logging)
if cpuProfile != "" {
if f, err := os.Create(cpuProfile); err != nil {