Maint: pass only single strings to logger methods
- Do not assume formatting from logger's interface - Allow to change golibs in the future to accept only strings for logger methods
This commit is contained in:
@@ -40,19 +40,19 @@ func (h *handlerV0) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/v1/version", http.StatusPermanentRedirect)
|
||||
case "/openvpn/actions/restart":
|
||||
outcome, _ := h.openvpn.ApplyStatus(h.ctx, constants.Stopped)
|
||||
h.logger.Info("openvpn: %s", outcome)
|
||||
h.logger.Info("openvpn: " + outcome)
|
||||
outcome, _ = h.openvpn.ApplyStatus(h.ctx, constants.Running)
|
||||
h.logger.Info("openvpn: %s", outcome)
|
||||
h.logger.Info("openvpn: " + outcome)
|
||||
if _, err := w.Write([]byte("openvpn restarted, please consider using the /v1/ API in the future.")); err != nil {
|
||||
h.logger.Warn(err)
|
||||
h.logger.Warn(err.Error())
|
||||
}
|
||||
case "/unbound/actions/restart":
|
||||
outcome, _ := h.dns.ApplyStatus(h.ctx, constants.Stopped)
|
||||
h.logger.Info("dns: %s", outcome)
|
||||
h.logger.Info("dns: " + outcome)
|
||||
outcome, _ = h.dns.ApplyStatus(h.ctx, constants.Running)
|
||||
h.logger.Info("dns: %s", outcome)
|
||||
h.logger.Info("dns: " + outcome)
|
||||
if _, err := w.Write([]byte("dns restarted, please consider using the /v1/ API in the future.")); err != nil {
|
||||
h.logger.Warn(err)
|
||||
h.logger.Warn(err.Error())
|
||||
}
|
||||
case "/openvpn/portforwarded":
|
||||
http.Redirect(w, r, "/v1/openvpn/portforwarded", http.StatusPermanentRedirect)
|
||||
@@ -60,11 +60,11 @@ func (h *handlerV0) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/v1/openvpn/settings", http.StatusPermanentRedirect)
|
||||
case "/updater/restart":
|
||||
outcome, _ := h.updater.SetStatus(h.ctx, constants.Stopped)
|
||||
h.logger.Info("updater: %s", outcome)
|
||||
h.logger.Info("updater: " + outcome)
|
||||
outcome, _ = h.updater.SetStatus(h.ctx, constants.Running)
|
||||
h.logger.Info("updater: %s", outcome)
|
||||
h.logger.Info("updater: " + outcome)
|
||||
if _, err := w.Write([]byte("updater restarted, please consider using the /v1/ API in the future.")); err != nil {
|
||||
h.logger.Warn(err)
|
||||
h.logger.Warn(err.Error())
|
||||
}
|
||||
default:
|
||||
http.Error(w, "unversioned API: requested URI not found", http.StatusNotFound)
|
||||
|
||||
Reference in New Issue
Block a user