2019-03-02 10:51:59 +01:00
|
|
|
import * as mongo from 'mongodb';
|
|
|
|
import db from '../db/mongodb';
|
|
|
|
|
|
|
|
const Log = db.get<ILog>('logs');
|
|
|
|
Log.createIndex('createdAt', { expireAfterSeconds: 3600 * 24 * 3 });
|
2019-03-04 11:26:05 +01:00
|
|
|
Log.createIndex('level');
|
|
|
|
Log.createIndex('domain');
|
2019-03-02 10:51:59 +01:00
|
|
|
export default Log;
|
|
|
|
|
|
|
|
export interface ILog {
|
|
|
|
_id: mongo.ObjectID;
|
|
|
|
createdAt: Date;
|
|
|
|
machine: string;
|
|
|
|
worker: string;
|
|
|
|
domain: string[];
|
|
|
|
level: string;
|
|
|
|
message: string;
|
|
|
|
data: any;
|
|
|
|
}
|