Feature: Web Panic Reporting via hooks
This PR is for issue of "email after registry webapp panic" #41, improving my previous design (closed). It use self setting up hooks, to catch panic in web application. And, send email in hooks handle directly, to no use new http server and handler. Signed-off-by: xiekeyang <keyangxie@126.com>
This commit is contained in:
@@ -25,6 +25,20 @@ log:
|
||||
fields:
|
||||
service: registry
|
||||
environment: staging
|
||||
hooks:
|
||||
- type: mail
|
||||
disabled: true
|
||||
levels:
|
||||
- panic
|
||||
options:
|
||||
smtp:
|
||||
addr: mail.example.com:25
|
||||
username: mailuser
|
||||
password: password
|
||||
insecure: true
|
||||
from: sender@example.com
|
||||
to:
|
||||
- errors@example.com
|
||||
loglevel: debug # deprecated: use "log"
|
||||
storage:
|
||||
filesystem:
|
||||
@@ -229,6 +243,28 @@ log:
|
||||
</td>
|
||||
</table>
|
||||
|
||||
## hooks
|
||||
|
||||
|
||||
```yaml
|
||||
hooks:
|
||||
- type: mail
|
||||
levels:
|
||||
- panic
|
||||
options:
|
||||
smtp:
|
||||
addr: smtp.sendhost.com:25
|
||||
username: sendername
|
||||
password: password
|
||||
insecure: true
|
||||
from: name@sendhost.com
|
||||
to:
|
||||
- name@receivehost.com
|
||||
```
|
||||
|
||||
The `hooks` subsection configures the logging hooks' behavior. This subsection
|
||||
includes a sequence handler which you can use for sending mail, for example.
|
||||
Refer to `loglevel` to configure the level of messages printed.
|
||||
|
||||
## loglevel
|
||||
|
||||
|
Reference in New Issue
Block a user