fix: excessive logging

This commit is contained in:
Eli Bosley
2024-01-11 16:34:10 -05:00
parent d7bb9ff073
commit 1615e8623c
3 changed files with 5 additions and 3 deletions

View File

@@ -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');

View 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') {

View 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
}