log_path / log_level configuration

This commit is contained in:
les 2021-05-27 00:04:10 +02:00
parent 9a864ec2eb
commit 197f031c41
No known key found for this signature in database
GPG key ID: 352918250B012177
4 changed files with 14 additions and 4 deletions

View file

@ -18,7 +18,7 @@
v-chip(v-if='selectedDay' close @click:close='dayChange({ date: selectedDay})') {{selectedDay}}
//- Events
#events.mb-2.mt-1.pl-1.pl-md-0
#events.mb-2.mt-1.pl-1.pl-sm-2
//- div.event(v-for='(event, idx) in events' :key='event.id' v-intersect="(entries, observer, isIntersecting) => intersecting[event.id] = isIntersecting")
Event(:event='event' v-for='(event, idx) in visibleEvents' :key='event.id' @tagclick='tagClick' @placeclick='placeClick')

View file

@ -162,6 +162,12 @@ async function setupQuestionnaire (is_docker, db) {
validate: notEmpty
})
questions.push({
name: 'log_path',
message: 'Log path',
default: '/opt/gancio/logs'
})
questions.push({
name: 'smtp_type',
message: 'How should we send the emails ?',
@ -228,6 +234,8 @@ async function setupQuestionnaire (is_docker, db) {
if (is_docker) {
answers.server = { host: '0.0.0.0', port: 13120 }
answers.upload_path = '/opt/gancio/uploads'
answers.log_level = 'debug'
answers.log_path = '/opt/gancio/logs'
if (db === 'sqlite') {
answers.db = { dialect: db, storage: '/opt/gancio/db.sqlite' }
} else {
@ -282,7 +290,7 @@ If this is your first run use 'gancio setup --config <CONFIG_FILE.json>' `)
}
const config = require('config')
await run_migrations(config.db)
consola.info(`Logging to ${path.resolve('./logs/gancio.log')} [level: ${config.loglevel}]`)
consola.info(`Logging to ${path.resolve(`${config.log_path}/gancio.log`)} [level: ${config.log_level}]`)
require('./index')
}

View file

@ -27,6 +27,8 @@ module.exports = {
delete config.smtp_need_auth
config.admin_email = admin.email
config.db.logging = false
config.log_level = 'debug'
config.log_path = '/opt/gancio/logs'
consola.info(`Save configuration to ${config_path}`)
try {
fs.writeFileSync(config_path, JSON.stringify(config, null, 2))

View file

@ -21,8 +21,8 @@ const logger = createLogger({
: [new DailyRotateFile({
handleExceptions: true,
handleRejections: true,
level: config.loglevel || 'info',
filename: './logs/gancio.%DATE%.log',
level: config.log_level || 'info',
filename: config.log_path + '/gancio.%DATE%.log',
symlinkName: 'gancio.log',
createSymlink: true,
zippedArchive: true,