debug.go 637 B

123456789101112131415161718192021222324252627
  1. // Copyright (C) 2014 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at https://mozilla.org/MPL/2.0/.
  6. package api
  7. import (
  8. "github.com/syncthing/syncthing/lib/logger"
  9. )
  10. var (
  11. l = logger.DefaultLogger.NewFacility("api", "REST API")
  12. )
  13. func shouldDebugHTTP() bool {
  14. return l.ShouldDebug("api")
  15. }
  16. func init() {
  17. // The debug facility was originally named "http", changed in:
  18. // https://github.com/syncthing/syncthing/pull/5548
  19. if l.IsTraced("http") {
  20. l.SetDebug("api", true)
  21. }
  22. }