summaryrefslogtreecommitdiff
path: root/src/models/log.ts
blob: 6f79e83c78c2f3df6709672354a79943bad2f9d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import * as mongo from 'mongodb';
import db from '../db/mongodb';

const Log = db.get<ILog>('logs');
Log.createIndex('createdAt', { expireAfterSeconds: 3600 * 24 * 3 });
Log.createIndex('level');
Log.createIndex('domain');
export default Log;

export interface ILog {
	_id: mongo.ObjectID;
	createdAt: Date;
	machine: string;
	worker: string;
	domain: string[];
	level: string;
	message: string;
	data: any;
}