From ff66f48ea2ddea59550341ed854640b7d5b80b3f Mon Sep 17 00:00:00 2001 From: Johann150 Date: Fri, 19 May 2023 00:59:53 +0200 Subject: [PATCH] remove syslog closes https://akkoma.dev/FoundKeyGang/FoundKey/issues/19 Changelog: Removed --- .config/example.yml | 5 ----- packages/backend/package.json | 2 -- packages/backend/src/config/types.ts | 5 ----- packages/backend/src/services/logger.ts | 27 +------------------------ yarn.lock | 25 ----------------------- 5 files changed, 1 insertion(+), 63 deletions(-) diff --git a/.config/example.yml b/.config/example.yml index 4146881b1..8d4a162cb 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -108,11 +108,6 @@ redis: #deliverJobMaxAttempts: 12 #inboxJobMaxAttempts: 8 -# Syslog option -#syslog: -# host: localhost -# port: 514 - # Proxy for HTTP/HTTPS outgoing connections #proxy: http://127.0.0.1:3128 diff --git a/packages/backend/package.json b/packages/backend/package.json index 5d7df7cfa..d9c830baf 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -100,7 +100,6 @@ "stringz": "2.1.0", "style-loader": "3.3.1", "summaly": "2.7.0", - "syslog-pro": "1.0.0", "systeminformation": "5.11.22", "tinycolor2": "1.4.2", "tmp": "0.2.1", @@ -158,7 +157,6 @@ "@types/sinon": "^10.0.13", "@types/sinonjs__fake-timers": "8.1.2", "@types/speakeasy": "2.0.7", - "@types/syslog-pro": "^1.0.0", "@types/tinycolor2": "1.4.3", "@types/tmp": "0.2.3", "@types/uuid": "8.3.4", diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index 55226ca47..686a8c242 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -59,11 +59,6 @@ export type Source = { deliverJobMaxAttempts?: number; inboxJobMaxAttempts?: number; - syslog?: { - host: string; - port: number; - }; - mediaProxy?: string; proxyRemoteFiles?: boolean; internalStoragePath?: string; diff --git a/packages/backend/src/services/logger.ts b/packages/backend/src/services/logger.ts index 7b0d1ce2b..5c24186b6 100644 --- a/packages/backend/src/services/logger.ts +++ b/packages/backend/src/services/logger.ts @@ -2,7 +2,6 @@ import cluster from 'node:cluster'; import chalk from 'chalk'; import convertColor from 'color-convert'; import { format as dateFormat } from 'date-fns'; -import * as SyslogPro from 'syslog-pro'; import config from '@/config/index.js'; import { envOption } from '@/env.js'; import type { KEYWORD } from 'color-convert/conversions.js'; @@ -22,13 +21,12 @@ export const LEVELS = { export type Level = LEVELS[keyof LEVELS]; /** - * Class that facilitates recording log messages to the console and optionally a syslog server. + * Class that facilitates recording log messages to the console. */ export default class Logger { private domain: Domain; private parentLogger: Logger | null = null; private store: boolean; - private syslogClient: SyslogPro.RFC5424 | null = null; /** * Messages below this level will be discarded. */ @@ -47,20 +45,6 @@ export default class Logger { }; this.store = store; this.minLevel = minLevel; - - if (config.syslog) { - this.syslogClient = new SyslogPro.RFC5424({ - applicationName: 'FoundKey', - timestamp: true, - includeStructuredData: true, - color: true, - extendedColor: true, - server: { - target: config.syslog.host, - port: config.syslog.port, - }, - }); - } } /** @@ -139,15 +123,6 @@ export default class Logger { if (envOption.withLogTime) log = chalk.gray(time) + ' ' + log; console.log(important ? chalk.bold(log) : log); - - if (store && this.syslogClient) { - const send = - level === LEVELS.error ? this.syslogClient.error : - level === LEVELS.warning ? this.syslogClient.warning : - this.syslogClient.info; - - send.bind(this.syslogClient)(message).catch(() => {}); - } } /** diff --git a/yarn.lock b/yarn.lock index 8d225b0f4..1786f0c51 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2443,13 +2443,6 @@ __metadata: languageName: node linkType: hard -"@types/syslog-pro@npm:^1.0.0": - version: 1.0.0 - resolution: "@types/syslog-pro@npm:1.0.0" - checksum: d0dcd87efad8a629bba449f86a617605a3fbffa5c18a8b309c82e7b85036ac21cfd34711fd522f50528dd0f0d07bdb66261a6f9ef20f2a9133e847b2e717c1bc - languageName: node - linkType: hard - "@types/throttle-debounce@npm:5.0.0": version: 5.0.0 resolution: "@types/throttle-debounce@npm:5.0.0" @@ -3702,7 +3695,6 @@ __metadata: "@types/sinon": ^10.0.13 "@types/sinonjs__fake-timers": 8.1.2 "@types/speakeasy": 2.0.7 - "@types/syslog-pro": ^1.0.0 "@types/tinycolor2": 1.4.3 "@types/tmp": 0.2.3 "@types/uuid": 8.3.4 @@ -3792,7 +3784,6 @@ __metadata: stringz: 2.1.0 style-loader: 3.3.1 summaly: 2.7.0 - syslog-pro: 1.0.0 systeminformation: 5.11.22 tinycolor2: 1.4.2 tmp: 0.2.1 @@ -12044,13 +12035,6 @@ __metadata: languageName: node linkType: hard -"moment@npm:^2.22.2": - version: 2.29.4 - resolution: "moment@npm:2.29.4" - checksum: 0ec3f9c2bcba38dc2451b1daed5daded747f17610b92427bebe1d08d48d8b7bdd8d9197500b072d14e326dd0ccf3e326b9e3d07c5895d3d49e39b6803b76e80e - languageName: node - linkType: hard - "ms@npm:2.0.0": version: 2.0.0 resolution: "ms@npm:2.0.0" @@ -16141,15 +16125,6 @@ __metadata: languageName: node linkType: hard -"syslog-pro@npm:1.0.0": - version: 1.0.0 - resolution: "syslog-pro@npm:1.0.0" - dependencies: - moment: ^2.22.2 - checksum: 7d6399e4ca3a9305758f77b3e720469b39c156b5a8219ed4ce27b4ad8f960f8e395aebb0ccc84e4438b50a6b2cda2e20251e278307833ed7ac1045ae9516a33c - languageName: node - linkType: hard - "systeminformation@npm:5.11.22": version: 5.11.22 resolution: "systeminformation@npm:5.11.22"