mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Desktop integration (#2073)
* Open stash in system tray on Windows/MacOS * Add desktop notifications * MacOS Bundling * Add binary icon Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
e48b2ba3e8
commit
0e514183a7
67
vendor/github.com/go-chi/httplog/README.md
generated
vendored
Normal file
67
vendor/github.com/go-chi/httplog/README.md
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
httplog
|
||||
=======
|
||||
|
||||
Small but powerful structured logging package for HTTP request logging in Go.
|
||||
|
||||
## Example
|
||||
|
||||
(see [_example/](./_example/main.go))
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/go-chi/httplog"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Logger
|
||||
logger := httplog.NewLogger("httplog-example", httplog.Options{
|
||||
JSON: true,
|
||||
})
|
||||
|
||||
// Service
|
||||
r := chi.NewRouter()
|
||||
r.Use(httplog.RequestLogger(logger))
|
||||
r.Use(middleware.Heartbeat("/ping"))
|
||||
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("hello world"))
|
||||
})
|
||||
|
||||
r.Get("/panic", func(w http.ResponseWriter, r *http.Request) {
|
||||
panic("oh no")
|
||||
})
|
||||
|
||||
r.Get("/info", func(w http.ResponseWriter, r *http.Request) {
|
||||
oplog := httplog.LogEntry(r.Context())
|
||||
w.Header().Add("Content-Type", "text/plain")
|
||||
oplog.Info().Msg("info here")
|
||||
w.Write([]byte("info here"))
|
||||
})
|
||||
|
||||
r.Get("/warn", func(w http.ResponseWriter, r *http.Request) {
|
||||
oplog := httplog.LogEntry(r.Context())
|
||||
oplog.Warn().Msg("warn here")
|
||||
w.WriteHeader(400)
|
||||
w.Write([]byte("warn here"))
|
||||
})
|
||||
|
||||
r.Get("/err", func(w http.ResponseWriter, r *http.Request) {
|
||||
oplog := httplog.LogEntry(r.Context())
|
||||
oplog.Error().Msg("err here")
|
||||
w.WriteHeader(500)
|
||||
w.Write([]byte("err here"))
|
||||
})
|
||||
|
||||
http.ListenAndServe(":5555", r)
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user