mirror of
https://github.com/unraid/api.git
synced 2026-01-08 01:29:49 -06:00
fix: excessive logging
This commit is contained in:
@@ -24,7 +24,7 @@ export const main = async (...argv: string[]) => {
|
||||
if (!process.env.LOG_TRANSPORT) {
|
||||
if (process.env.ENVIRONMENT === 'production' && !mainOptions.debug) {
|
||||
setEnv('LOG_TRANSPORT', 'file');
|
||||
setEnv('LOG_LEVEL', 'DEBUG');
|
||||
setEnv('LOG_LEVEL', 'INFO');
|
||||
} else if (!mainOptions.debug) {
|
||||
// Staging Environment, backgrounded plugin
|
||||
setEnv('LOG_TRANSPORT', 'file');
|
||||
|
||||
@@ -2,7 +2,7 @@ import { pino } from 'pino';
|
||||
import { LOG_TRANSPORT, LOG_TYPE } from '@app/environment';
|
||||
|
||||
import pretty from 'pino-pretty';
|
||||
import { chmodSync, existsSync, mkdirSync } from 'node:fs';
|
||||
import { chmodSync, existsSync, mkdirSync, rmSync } from 'node:fs';
|
||||
import { getters } from '@app/store/index';
|
||||
import { join } from 'node:path';
|
||||
|
||||
@@ -13,6 +13,8 @@ const makeLoggingDirectoryIfNotExists = () => {
|
||||
}
|
||||
|
||||
chmodSync(getters.paths()['log-base'], 0o644);
|
||||
|
||||
rmSync(`${getters.paths()['log-base']}/stdout.log.*`);
|
||||
};
|
||||
|
||||
if (LOG_TRANSPORT === 'file') {
|
||||
|
||||
@@ -9,7 +9,7 @@ export const setupLogRotation = async () => {
|
||||
'/etc/logrotate.d/unraid-api',
|
||||
`
|
||||
/var/log/unraid-api/*.log {
|
||||
rotate 2
|
||||
rotate 1
|
||||
missingok
|
||||
size 5M
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user