LogAppend implements a middleware that takes a key and value, where the key is the name of a log field and the value is a placeholder, or variable key, or constant value to use for that field.
| 34 | // the key is the name of a log field and the value is a placeholder, |
| 35 | // or variable key, or constant value to use for that field. |
| 36 | type LogAppend struct { |
| 37 | // Key is the name of the log field. |
| 38 | Key string `json:"key,omitempty"` |
| 39 | |
| 40 | // Value is the value to use for the log field. |
| 41 | // If it is a placeholder (with surrounding `{}`), |
| 42 | // it will be evaluated when the log is written. |
| 43 | // If the value is a key that exists in the `vars` |
| 44 | // map, the value of that key will be used. Otherwise |
| 45 | // the value will be used as-is as a constant string. |
| 46 | Value string `json:"value,omitempty"` |
| 47 | |
| 48 | // Early, if true, adds the log field before calling |
| 49 | // the next handler in the chain. By default, the log |
| 50 | // field is added on the way back up the middleware chain, |
| 51 | // after all subsequent handlers have completed. |
| 52 | Early bool `json:"early,omitempty"` |
| 53 | } |
| 54 | |
| 55 | // CaddyModule returns the Caddy module information. |
| 56 | func (LogAppend) CaddyModule() caddy.ModuleInfo { |
nothing calls this directly
no outgoing calls
no test coverage detected