The DTP Sites web app development engine.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

29 lines
653 B

// log.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const LOG_LEVEL_LIST = [
'debug',
'info',
'warn',
'alert',
'error',
'crit',
'fatal',
];
const LogSchema = new Schema({
created: { type: Date, default: Date.now, required: true, index: -1, expires: '7d' },
componentName: { type: String, required: true, index: 1 },
level: { type: String, enum: LOG_LEVEL_LIST, required: true, index: true },
message: { type: String },
metadata: { type: Schema.Types.Mixed },
});
module.exports = mongoose.model('Log', LogSchema);