fix!: fixed logging service not logging to file, removed app-info log file.

This commit is contained in:
Marius Begby committed 2023-08-28 18:23:12 +02:00
1 parent 780e20d419
commit 92a535d837
4 files changed
+15 -20

No files matched your search

+1 -1
View File
@@ -34,7 +34,6 @@ module.exports = {
logger.debug('Interaction received.');
let interactionIdentifier = 'Unknown';
if (
interaction.type === InteractionType.ApplicationCommand ||
interaction.type === InteractionType.ApplicationCommandAutocomplete
@@ -73,6 +72,7 @@ module.exports = {
const outputTime: number = new Date().getTime();
const executionTime: number = outputTime - inputTime;
const interactionType = InteractionType[interaction.type];
logger.info(
+6 -13
View File
@@ -9,28 +9,19 @@ const loggerOptions: LoggerOptions = config.get('loggerOptions');
const targets: TargetOptions[] = [
{
// This target is used for logging everything above specified minimumLogLevel
target: 'pino/file',
level: loggerOptions.minimumLogLevel,
options: {
destination: './logs/app-all.log',
mkdir: true,
sync: false,
minLength: 4096
sync: false
}
},
{
// This target is used for logging errors separately
target: 'pino/file',
level: pino.levels.values.info.toString(),
options: {
destination: './logs/app-info.log',
mkdir: true,
sync: false,
minLength: 4096
}
},
{
target: 'pino/file',
level: pino.levels.values.error.toString(),
level: 'error',
options: {
destination: './logs/app-error.log',
mkdir: true,
@@ -38,6 +29,7 @@ const targets: TargetOptions[] = [
}
},
{
// This target is used for logging to the console
target: 'pino/file',
level: loggerOptions.minimumLogLevelConsole,
options: {
@@ -57,6 +49,7 @@ if (process.env.LOKI_AUTH_PASSWORD && process.env.LOKI_AUTH_USERNAME) {
batching: false,
interval: 5,
// Loki host and credentials are retrieved from environment variables
host: process.env.LOKI_HOST || 'http://localhost:3100',
basicAuth: {
username: process.env.LOKI_AUTH_USERNAME || '',
+5 -5
View File
@@ -1,6 +1,6 @@
import {
ActivityType, ColorResolvable, PresenceUpdateStatus, ShardingManagerOptions
} from 'discord.js';
import { ActivityType, ColorResolvable, PresenceUpdateStatus, ShardingManagerOptions } from 'discord.js';
import { LogLevel } from './serviceTypes';
export interface BotOptions {
name: string;
@@ -11,8 +11,8 @@ export interface BotOptions {
export interface ShardingOptions extends ShardingManagerOptions {}
export interface LoggerOptions {
minimumLogLevel: string;
minimumLogLevelConsole: string;
minimumLogLevel: LogLevel;
minimumLogLevelConsole: LogLevel;
discordPlayerDebug: boolean;
}
+3 -1
View File
@@ -1,6 +1,8 @@
export type LogLevel = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'silent';
export type TargetOptions = {
target: string;
level: string;
level: LogLevel;
options: {
destination?: string;
mkdir?: boolean;