mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-11 17:10:54 +01:00
Better logging
This commit is contained in:
parent
f53a93ea13
commit
d55277e57e
1 changed files with 7 additions and 2 deletions
|
@ -11,7 +11,7 @@ import * as Koa from 'koa';
|
||||||
import * as Router from 'koa-router';
|
import * as Router from 'koa-router';
|
||||||
import * as mount from 'koa-mount';
|
import * as mount from 'koa-mount';
|
||||||
import * as compress from 'koa-compress';
|
import * as compress from 'koa-compress';
|
||||||
import * as logger from 'koa-logger';
|
import * as koaLogger from 'koa-logger';
|
||||||
import * as requestStats from 'request-stats';
|
import * as requestStats from 'request-stats';
|
||||||
//const slow = require('koa-slow');
|
//const slow = require('koa-slow');
|
||||||
|
|
||||||
|
@ -22,6 +22,9 @@ import networkChart from '../chart/network';
|
||||||
import apiServer from './api';
|
import apiServer from './api';
|
||||||
import { sum } from '../prelude/array';
|
import { sum } from '../prelude/array';
|
||||||
import User from '../models/user';
|
import User from '../models/user';
|
||||||
|
import Logger from '../misc/logger';
|
||||||
|
|
||||||
|
const logger = new Logger('server');
|
||||||
|
|
||||||
// Init app
|
// Init app
|
||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
|
@ -29,7 +32,9 @@ app.proxy = true;
|
||||||
|
|
||||||
if (!['production', 'test'].includes(process.env.NODE_ENV)) {
|
if (!['production', 'test'].includes(process.env.NODE_ENV)) {
|
||||||
// Logger
|
// Logger
|
||||||
app.use(logger());
|
app.use(koaLogger(str => {
|
||||||
|
logger.info(str);
|
||||||
|
}));
|
||||||
|
|
||||||
// Delay
|
// Delay
|
||||||
//app.use(slow({
|
//app.use(slow({
|
||||||
|
|
Loading…
Reference in a new issue