mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-26 03:46:42 +00:00
GODT-1779: Remove go-imap
This commit is contained in:
28
internal/app/logging.go
Normal file
28
internal/app/logging.go
Normal file
@ -0,0 +1,28 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/crash"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/locations"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/logging"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func initLogging(c *cli.Context, locations *locations.Locations, crashHandler *crash.Handler) error {
|
||||
// Get a place to keep our logs.
|
||||
logsPath, err := locations.ProvideLogsPath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not provide logs path: %w", err)
|
||||
}
|
||||
|
||||
// Initialize logging.
|
||||
if err := logging.Init(logsPath, c.String(flagLogLevel)); err != nil {
|
||||
return fmt.Errorf("could not initialize logging: %w", err)
|
||||
}
|
||||
|
||||
// Ensure we dump a stack trace if we crash.
|
||||
crashHandler.AddRecoveryAction(logging.DumpStackTrace(logsPath))
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user