mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
chore: get rid of static code warnings
This commit is contained in:
@@ -19,6 +19,22 @@ func LogClose(c io.Closer) {
|
||||
}
|
||||
}
|
||||
|
||||
// LogError logs the given error if it is not nil.
|
||||
// If a message is given, it is prepended to the error message.
|
||||
// Only the first message is used.
|
||||
func LogError(err error, msg ...string) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if len(msg) > 0 {
|
||||
logrus.Errorf("%s: %v", msg[0], err)
|
||||
return
|
||||
}
|
||||
logrus.Errorf("error: %v", err)
|
||||
|
||||
}
|
||||
|
||||
// SignalAwareContext returns a context that gets closed once a given signal is retrieved.
|
||||
// By default, the following signals are handled: syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP
|
||||
func SignalAwareContext(ctx context.Context, sig ...os.Signal) context.Context {
|
||||
|
Reference in New Issue
Block a user