parent
							
								
									449761bada
								
							
						
					
					
						commit
						825551d64f
					
				
					 9 changed files with 4 additions and 78 deletions
				
			
		| 
						 | 
				
			
			@ -114,11 +114,6 @@ id: 'aid'
 | 
			
		|||
# IP address family used for outgoing request (ipv4, ipv6 or dual)
 | 
			
		||||
#outgoingAddressFamily: ipv4
 | 
			
		||||
 | 
			
		||||
# Syslog option
 | 
			
		||||
#syslog:
 | 
			
		||||
#  host: localhost
 | 
			
		||||
#  port: 514
 | 
			
		||||
 | 
			
		||||
# Proxy for HTTP/HTTPS
 | 
			
		||||
#proxy: http://127.0.0.1:3128
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,11 +114,6 @@ id: 'aid'
 | 
			
		|||
# IP address family used for outgoing request (ipv4, ipv6 or dual)
 | 
			
		||||
#outgoingAddressFamily: ipv4
 | 
			
		||||
 | 
			
		||||
# Syslog option
 | 
			
		||||
#syslog:
 | 
			
		||||
#  host: localhost
 | 
			
		||||
#  port: 514
 | 
			
		||||
 | 
			
		||||
# Proxy for HTTP/HTTPS
 | 
			
		||||
#proxy: http://127.0.0.1:3128
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,7 @@ You should also include the user name that made the change.
 | 
			
		|||
### Changes
 | 
			
		||||
- twitter/github/discord連携機能が削除されました
 | 
			
		||||
- ハッシュタグごとのチャートが削除されました
 | 
			
		||||
- syslogのサポートが削除されました
 | 
			
		||||
 | 
			
		||||
### Improvements
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,11 +133,6 @@ id: "aid"
 | 
			
		|||
# IP address family used for outgoing request (ipv4, ipv6 or dual)
 | 
			
		||||
#outgoingAddressFamily: ipv4
 | 
			
		||||
 | 
			
		||||
# Syslog option
 | 
			
		||||
#syslog:
 | 
			
		||||
#  host: localhost
 | 
			
		||||
#  port: 514
 | 
			
		||||
 | 
			
		||||
# Proxy for HTTP/HTTPS
 | 
			
		||||
#proxy: http://127.0.0.1:3128
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,7 +110,6 @@
 | 
			
		|||
		"strict-event-emitter-types": "2.0.0",
 | 
			
		||||
		"stringz": "2.1.0",
 | 
			
		||||
		"summaly": "2.7.0",
 | 
			
		||||
		"syslog-pro": "git+https://github.com/misskey-dev/SyslogPro#0.2.9-misskey.2",
 | 
			
		||||
		"systeminformation": "5.17.8",
 | 
			
		||||
		"tinycolor2": "1.5.2",
 | 
			
		||||
		"tmp": "0.2.1",
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +166,6 @@
 | 
			
		|||
		"@types/sharp": "0.31.1",
 | 
			
		||||
		"@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/unzipper": "0.10.5",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,11 +65,6 @@ export type Source = {
 | 
			
		|||
	deliverJobMaxAttempts?: number;
 | 
			
		||||
	inboxJobMaxAttempts?: number;
 | 
			
		||||
 | 
			
		||||
	syslog: {
 | 
			
		||||
		host: string;
 | 
			
		||||
		port: number;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	mediaProxy?: string;
 | 
			
		||||
	proxyRemoteFiles?: boolean;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +108,7 @@ const path = process.env.NODE_ENV === 'test'
 | 
			
		|||
 | 
			
		||||
export function loadConfig() {
 | 
			
		||||
	const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8'));
 | 
			
		||||
	const clientManifestExists = fs.existsSync(_dirname + '/../../../built/_vite_/manifest.json')
 | 
			
		||||
	const clientManifestExists = fs.existsSync(_dirname + '/../../../built/_vite_/manifest.json');
 | 
			
		||||
	const clientManifest = clientManifestExists ?
 | 
			
		||||
		JSON.parse(fs.readFileSync(`${_dirname}/../../../built/_vite_/manifest.json`, 'utf-8'))
 | 
			
		||||
		: { 'src/init.ts': { file: 'src/init.ts' } };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
import { Inject, Injectable } from '@nestjs/common';
 | 
			
		||||
import * as SyslogPro from 'syslog-pro';
 | 
			
		||||
import { DI } from '@/di-symbols.js';
 | 
			
		||||
import type { Config } from '@/config.js';
 | 
			
		||||
import Logger from '@/logger.js';
 | 
			
		||||
| 
						 | 
				
			
			@ -8,29 +7,14 @@ import type { KEYWORD } from 'color-convert/conversions';
 | 
			
		|||
 | 
			
		||||
@Injectable()
 | 
			
		||||
export class LoggerService {
 | 
			
		||||
	private syslogClient;
 | 
			
		||||
 | 
			
		||||
	constructor(
 | 
			
		||||
		@Inject(DI.config)
 | 
			
		||||
		private config: Config,
 | 
			
		||||
	) {
 | 
			
		||||
		if (this.config.syslog) {
 | 
			
		||||
			this.syslogClient = new SyslogPro.RFC5424({
 | 
			
		||||
				applicationName: 'Misskey',
 | 
			
		||||
				timestamp: true,
 | 
			
		||||
				includeStructuredData: true,
 | 
			
		||||
				color: true,
 | 
			
		||||
				extendedColor: true,
 | 
			
		||||
				server: {
 | 
			
		||||
					target: config.syslog.host,
 | 
			
		||||
					port: config.syslog.port,
 | 
			
		||||
				},
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@bindThis
 | 
			
		||||
	public getLogger(domain: string, color?: KEYWORD | undefined, store?: boolean) {
 | 
			
		||||
		return new Logger(domain, color, store, this.syslogClient);
 | 
			
		||||
		return new Logger(domain, color, store);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,15 +17,13 @@ export default class Logger {
 | 
			
		|||
	private context: Context;
 | 
			
		||||
	private parentLogger: Logger | null = null;
 | 
			
		||||
	private store: boolean;
 | 
			
		||||
	private syslogClient: any | null = null;
 | 
			
		||||
 | 
			
		||||
	constructor(context: string, color?: KEYWORD, store = true, syslogClient = null) {
 | 
			
		||||
	constructor(context: string, color?: KEYWORD, store = true) {
 | 
			
		||||
		this.context = {
 | 
			
		||||
			name: context,
 | 
			
		||||
			color: color,
 | 
			
		||||
		};
 | 
			
		||||
		this.store = store;
 | 
			
		||||
		this.syslogClient = syslogClient;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@bindThis
 | 
			
		||||
| 
						 | 
				
			
			@ -69,20 +67,6 @@ export default class Logger {
 | 
			
		|||
 | 
			
		||||
		console.log(important ? chalk.bold(log) : log);
 | 
			
		||||
		if (level === 'error' && data) console.log(data);
 | 
			
		||||
 | 
			
		||||
		if (store) {
 | 
			
		||||
			if (this.syslogClient) {
 | 
			
		||||
				const send =
 | 
			
		||||
					level === 'error' ? this.syslogClient.error :
 | 
			
		||||
					level === 'warning' ? this.syslogClient.warning :
 | 
			
		||||
					level === 'success' ? this.syslogClient.info :
 | 
			
		||||
					level === 'debug' ? this.syslogClient.info :
 | 
			
		||||
					level === 'info' ? this.syslogClient.info :
 | 
			
		||||
					null as never;
 | 
			
		||||
 | 
			
		||||
				send.bind(this.syslogClient)(message).catch(() => {});
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@bindThis
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										21
									
								
								pnpm-lock.yaml
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										21
									
								
								pnpm-lock.yaml
									
										
									
										generated
									
									
									
								
							| 
						 | 
				
			
			@ -104,7 +104,6 @@ importers:
 | 
			
		|||
      '@types/sharp': 0.31.1
 | 
			
		||||
      '@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/unzipper': 0.10.5
 | 
			
		||||
| 
						 | 
				
			
			@ -192,7 +191,6 @@ importers:
 | 
			
		|||
      strict-event-emitter-types: 2.0.0
 | 
			
		||||
      stringz: 2.1.0
 | 
			
		||||
      summaly: 2.7.0
 | 
			
		||||
      syslog-pro: git+https://github.com/misskey-dev/SyslogPro#0.2.9-misskey.2
 | 
			
		||||
      systeminformation: 5.17.8
 | 
			
		||||
      tinycolor2: 1.5.2
 | 
			
		||||
      tmp: 0.2.1
 | 
			
		||||
| 
						 | 
				
			
			@ -297,7 +295,6 @@ importers:
 | 
			
		|||
      strict-event-emitter-types: 2.0.0
 | 
			
		||||
      stringz: 2.1.0
 | 
			
		||||
      summaly: 2.7.0
 | 
			
		||||
      syslog-pro: github.com/misskey-dev/SyslogPro/2772b33fa126784fc6e21377786471a918b22dc7
 | 
			
		||||
      systeminformation: 5.17.8
 | 
			
		||||
      tinycolor2: 1.5.2
 | 
			
		||||
      tmp: 0.2.1
 | 
			
		||||
| 
						 | 
				
			
			@ -356,7 +353,6 @@ importers:
 | 
			
		|||
      '@types/sharp': 0.31.1
 | 
			
		||||
      '@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/unzipper': 0.10.5
 | 
			
		||||
| 
						 | 
				
			
			@ -2817,10 +2813,6 @@ packages:
 | 
			
		|||
    resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
 | 
			
		||||
    dev: true
 | 
			
		||||
 | 
			
		||||
  /@types/syslog-pro/1.0.0:
 | 
			
		||||
    resolution: {integrity: sha512-yFQ7QbEQrswboLGflCumcUMLeD5GgnaHH80khqoYDdeEqVST5UWTppit8BtavxhrkWjfeX8aPI6c047ooWQrdw==}
 | 
			
		||||
    dev: true
 | 
			
		||||
 | 
			
		||||
  /@types/throttle-debounce/5.0.0:
 | 
			
		||||
    resolution: {integrity: sha512-Pb7k35iCGFcGPECoNE4DYp3Oyf2xcTd3FbFQxXUI9hEYKUl6YX+KLf7HrBmgVcD05nl50LIH6i+80js4iYmWbw==}
 | 
			
		||||
    dev: true
 | 
			
		||||
| 
						 | 
				
			
			@ -9489,10 +9481,6 @@ packages:
 | 
			
		|||
      obliterator: 2.0.4
 | 
			
		||||
    dev: false
 | 
			
		||||
 | 
			
		||||
  /moment/2.29.4:
 | 
			
		||||
    resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==}
 | 
			
		||||
    dev: false
 | 
			
		||||
 | 
			
		||||
  /ms/2.0.0:
 | 
			
		||||
    resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
 | 
			
		||||
    dev: false
 | 
			
		||||
| 
						 | 
				
			
			@ -13662,15 +13650,6 @@ packages:
 | 
			
		|||
      readable-stream: 3.6.0
 | 
			
		||||
    dev: false
 | 
			
		||||
 | 
			
		||||
  github.com/misskey-dev/SyslogPro/2772b33fa126784fc6e21377786471a918b22dc7:
 | 
			
		||||
    resolution: {tarball: https://codeload.github.com/misskey-dev/SyslogPro/tar.gz/2772b33fa126784fc6e21377786471a918b22dc7}
 | 
			
		||||
    name: '@zeit/syslog-pro'
 | 
			
		||||
    version: 0.2.9-misskey.2
 | 
			
		||||
    engines: {node: '>=10.0.0'}
 | 
			
		||||
    dependencies:
 | 
			
		||||
      moment: 2.29.4
 | 
			
		||||
    dev: false
 | 
			
		||||
 | 
			
		||||
  github.com/misskey-dev/browser-image-resizer/0227e860621e55cbed0aabe6dc601096a7748c4a:
 | 
			
		||||
    resolution: {tarball: https://codeload.github.com/misskey-dev/browser-image-resizer/tar.gz/0227e860621e55cbed0aabe6dc601096a7748c4a}
 | 
			
		||||
    name: browser-image-resizer
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue