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.
 
 
 
 
 

44 lines
901 B

// log.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const mongoose = require('mongoose');
const Log = mongoose.model('Log');
const { SiteService } = require('../../lib/site-lib');
class SystemLogService extends SiteService {
constructor (dtp) {
super(dtp, module.exports);
}
async getRecords (search, pagination) {
const logs = await Log
.find(search)
.sort({ created: -1 })
.skip(pagination.skip)
.limit(pagination.cpp)
.lean();
return logs;
}
async getComponentNames ( ) {
return await Log.distinct('componentName');
}
async getTotalCount ( ) {
const count = await Log.estimatedDocumentCount();
this.log.debug('log message total count', { count });
return count;
}
}
module.exports = {
slug: 'log',
name: 'log',
create: (dtp) => { return new SystemLogService(dtp); },
};