ログをデータベースに保存して管理画面で見れるように
This commit is contained in:
parent
f3ceb32a7c
commit
977af0a24d
29 changed files with 326 additions and 99 deletions
17
src/models/log.ts
Normal file
17
src/models/log.ts
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue