# README
Caddy2-zlog
Overview
zlog
is a log middleware for Caddy v2, it's based on https://github.com/rs/zerolog and https://github.com/liuzl/filestore.
Installation
Rebuild caddy as follows:
xcaddy build --with github.com/liuzl/caddy2-zlog
Caddyfile syntax
127.0.0.1:2021 {
zlog {
log_dir ./server_zerolog
split_by hour
hash_dir ./hashstore
}
}
# Functions
AccessHandler returns a handler that call f after each request.
No description provided by the author
No description provided by the author
No description provided by the author
FromRequest gets the logger in the request's context.
HeaderHandler adds the request's headerName from Header as a field to the context's logger using headerName as field key.
IDFromRequest returns the unique id associated to the request if any.
MethodHandler adds the request method as a field to the context's logger using fieldKey as field key.
New creates a new chain, memorizing the given list of middleware constructors.
NewHandler injects log into requests context.
No description provided by the author
RefererHandler adds the request's referer as a field to the context's logger using fieldKey as field key.
RemoteAddrHandler adds the request's remote address as a field to the context's logger using fieldKey as field key.
RequestHandler adds the request method and URL as a field to the context's logger using fieldKey as field key.
RequestIDHandler returns a handler setting a unique id to the request which can be gathered using IDFromRequest(req).
No description provided by the author
URLHandler adds the requested URL as a field to the context's logger using fieldKey as field key.
UserAgentHandler adds the request's user-agent as a field to the context's logger using fieldKey as field key.
# Structs
Chain acts as a list of caddyhttp.Handler constructors.
Middleware implements an HTTP handler that logs the whole response by zerolog.
No description provided by the author
No description provided by the author
# Type aliases
A constructor for a piece of middleware.