ログをデータベースに保存して管理画面で見れるように
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import * as mongo from 'mongodb';
|
||||
import db from '../db/mongodb';
|
||||
|
||||
const Log = db.get<ILog>('logs');
|
||||
Log.createIndex('createdAt', { expireAfterSeconds: 3600 * 24 * 3 });
|
||||
export default Log;
|
||||
|
||||
export interface ILog {
|
||||
_id: mongo.ObjectID;
|
||||
createdAt: Date;
|
||||
machine: string;
|
||||
worker: string;
|
||||
domain: string[];
|
||||
level: string;
|
||||
message: string;
|
||||
data: any;
|
||||
}
|
||||
Reference in New Issue
Block a user