mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
GODT-1120 hotfix: use Info level in internal/app logs
This commit is contained in:
@ -136,7 +136,6 @@ func New( // nolint[funlen]
|
|||||||
if err := logging.Init(logsPath); err != nil {
|
if err := logging.Init(logsPath); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
logging.SetLevel("debug") // Proper level is set later in run.
|
|
||||||
crashHandler.AddRecoveryAction(logging.DumpStackTrace(logsPath))
|
crashHandler.AddRecoveryAction(logging.DumpStackTrace(logsPath))
|
||||||
|
|
||||||
if err := migrateFiles(configName); err != nil {
|
if err := migrateFiles(configName); err != nil {
|
||||||
|
|||||||
@ -111,7 +111,7 @@ func moveIfExists(source, destination string) error {
|
|||||||
l := logrus.WithField("source", source).WithField("destination", destination)
|
l := logrus.WithField("source", source).WithField("destination", destination)
|
||||||
|
|
||||||
if _, err := os.Stat(source); os.IsNotExist(err) {
|
if _, err := os.Stat(source); os.IsNotExist(err) {
|
||||||
l.Debug("No need to migrate file, source doesn't exist")
|
l.Info("No need to migrate file, source doesn't exist")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -189,9 +189,10 @@ func generateTLSCerts(b *base.Base) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkAndHandleUpdate(u types.Updater, f frontend.Frontend, autoUpdate bool) {
|
func checkAndHandleUpdate(u types.Updater, f frontend.Frontend, autoUpdate bool) {
|
||||||
|
log := logrus.WithField("pkg", "app/bridge")
|
||||||
version, err := u.Check()
|
version, err := u.Check()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Error("An error occurred while checking for updates")
|
log.WithError(err).Error("An error occurred while checking for updates")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,11 +202,11 @@ func checkAndHandleUpdate(u types.Updater, f frontend.Frontend, autoUpdate bool)
|
|||||||
f.SetVersion(version)
|
f.SetVersion(version)
|
||||||
|
|
||||||
if !u.IsUpdateApplicable(version) {
|
if !u.IsUpdateApplicable(version) {
|
||||||
logrus.Debug("No need to update")
|
log.Info("No need to update")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.WithField("version", version.Version).Info("An update is available")
|
log.WithField("version", version.Version).Info("An update is available")
|
||||||
|
|
||||||
if !autoUpdate {
|
if !autoUpdate {
|
||||||
f.NotifyManualUpdate(version, u.CanInstall(version))
|
f.NotifyManualUpdate(version, u.CanInstall(version))
|
||||||
@ -213,16 +214,16 @@ func checkAndHandleUpdate(u types.Updater, f frontend.Frontend, autoUpdate bool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !u.CanInstall(version) {
|
if !u.CanInstall(version) {
|
||||||
logrus.Info("A manual update is required")
|
log.Info("A manual update is required")
|
||||||
f.NotifySilentUpdateError(updater.ErrManualUpdateRequired)
|
f.NotifySilentUpdateError(updater.ErrManualUpdateRequired)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := u.InstallUpdate(version); err != nil {
|
if err := u.InstallUpdate(version); err != nil {
|
||||||
if errors.Cause(err) == updater.ErrDownloadVerify {
|
if errors.Cause(err) == updater.ErrDownloadVerify {
|
||||||
logrus.WithError(err).Warning("Skipping update installation due to temporary error")
|
log.WithError(err).Warning("Skipping update installation due to temporary error")
|
||||||
} else {
|
} else {
|
||||||
logrus.WithError(err).Error("The update couldn't be installed")
|
log.WithError(err).Error("The update couldn't be installed")
|
||||||
f.NotifySilentUpdateError(err)
|
f.NotifySilentUpdateError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -87,9 +87,10 @@ func run(b *base.Base, c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkAndHandleUpdate(u types.Updater, f frontend.Frontend, autoUpdate bool) { //nolint[unparam]
|
func checkAndHandleUpdate(u types.Updater, f frontend.Frontend, autoUpdate bool) { //nolint[unparam]
|
||||||
|
log := logrus.WithField("pkg", "app/ie")
|
||||||
version, err := u.Check()
|
version, err := u.Check()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Error("An error occurred while checking for updates")
|
log.WithError(err).Error("An error occurred while checking for updates")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,11 +100,11 @@ func checkAndHandleUpdate(u types.Updater, f frontend.Frontend, autoUpdate bool)
|
|||||||
f.SetVersion(version)
|
f.SetVersion(version)
|
||||||
|
|
||||||
if !u.IsUpdateApplicable(version) {
|
if !u.IsUpdateApplicable(version) {
|
||||||
logrus.Debug("No need to update")
|
log.Info("No need to update")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.WithField("version", version.Version).Info("An update is available")
|
log.WithField("version", version.Version).Info("An update is available")
|
||||||
|
|
||||||
f.NotifyManualUpdate(version, u.CanInstall(version))
|
f.NotifyManualUpdate(version, u.CanInstall(version))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,10 @@ func Init(logsPath string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetLevel will change the level of logging and in case of Debug or Trace
|
||||||
|
// level it will also prevent from writing to file. Setting level to Info or
|
||||||
|
// higher will not set writing to file again if it was previously cancelled by
|
||||||
|
// Debug or Trace.
|
||||||
func SetLevel(level string) {
|
func SetLevel(level string) {
|
||||||
if lvl, err := logrus.ParseLevel(level); err == nil {
|
if lvl, err := logrus.ParseLevel(level); err == nil {
|
||||||
logrus.SetLevel(lvl)
|
logrus.SetLevel(lvl)
|
||||||
|
|||||||
Reference in New Issue
Block a user