feat(xo-server): logging is now dynamically configurable
This commit is contained in:
parent
f5111c0f41
commit
f20d5cd8d3
@ -34,5 +34,5 @@
|
|||||||
- @xen-orchestra/log minor
|
- @xen-orchestra/log minor
|
||||||
- @xen-orchestra/mixins patch
|
- @xen-orchestra/mixins patch
|
||||||
- xo-server-auth-ldap patch
|
- xo-server-auth-ldap patch
|
||||||
- xo-server patch
|
- xo-server minor
|
||||||
- xo-web minor
|
- xo-web minor
|
||||||
|
@ -131,6 +131,13 @@ port = 80
|
|||||||
[http.mounts]
|
[http.mounts]
|
||||||
'/' = '../xo-web/dist'
|
'/' = '../xo-web/dist'
|
||||||
|
|
||||||
|
[logs]
|
||||||
|
# Display all logs matching this filter, regardless of their level
|
||||||
|
#filter = 'xo:load-balancer'
|
||||||
|
|
||||||
|
# Display all logs with level >=, regardless of their namespace
|
||||||
|
level = 'info'
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
|
|
||||||
[remoteOptions]
|
[remoteOptions]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import transportConsole from '@xen-orchestra/log/transports/console.js'
|
||||||
|
import { configure } from '@xen-orchestra/log/configure.js'
|
||||||
import { defer, fromEvent } from 'promise-toolbox'
|
import { defer, fromEvent } from 'promise-toolbox'
|
||||||
|
|
||||||
import LevelDbLogger from './loggers/leveldb.mjs'
|
import LevelDbLogger from './loggers/leveldb.mjs'
|
||||||
@ -7,6 +9,17 @@ export default class Logs {
|
|||||||
this._app = app
|
this._app = app
|
||||||
|
|
||||||
app.hooks.on('clean', () => this._gc())
|
app.hooks.on('clean', () => this._gc())
|
||||||
|
|
||||||
|
const transport = transportConsole()
|
||||||
|
app.config.watch('logs', ({ filter, level }) => {
|
||||||
|
configure([
|
||||||
|
{
|
||||||
|
filter: [process.env.DEBUG, filter],
|
||||||
|
level,
|
||||||
|
transport,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async _gc(keep = 2e4) {
|
async _gc(keep = 2e4) {
|
||||||
|
Loading…
Reference in New Issue
Block a user