Checkpoint

This commit is contained in:
Bryan Ashby 2020-12-07 19:52:54 -07:00
parent 2c361bf6cc
commit 7aafb0b0c4
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
2 changed files with 48 additions and 26 deletions

View File

@ -248,7 +248,16 @@
mainMenuWaitingForCaller: { mainMenuWaitingForCaller: {
config: { config: {
quickLogLevel: warn nowDateTimeFormat: "|00|11dddd|08, |11MMMM Do YYYY |08/ |11h|08:|11mm|08:|11ss|03a"
lastLoginDateTimeFormat: "|00|11ddd h|08:|11mm|03a"
mainInfoFormat10: "|00|11{now} {currentUserName} |08- |03mail|08: "
mainInfoFormat11: "|00|10{callsToday:>5}"
mainInfoFormat12: "|00|10{postsToday:>5}"
mainInfoFormat19: "|00|10{lastLoginUserName:<19} |02{lastLogin}"
quickLogLevel: info
quickLogLevelIndicators: { quickLogLevelIndicators: {
trace : |00|02T trace : |00|02T
debug: |00|03D debug: |00|03D

View File

@ -4,6 +4,7 @@ const { MenuModule } = require('./menu_module');
const { getActiveConnectionList } = require('./client_connections'); const { getActiveConnectionList } = require('./client_connections');
const StatLog = require('./stat_log'); const StatLog = require('./stat_log');
const SysProps = require('./system_property'); const SysProps = require('./system_property');
const UserProps = require('./user_property');
const Log = require('./logger'); const Log = require('./logger');
const Config = require('./config.js').get; const Config = require('./config.js').get;
@ -71,9 +72,9 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
return callback(null); return callback(null);
} }
const logLevel = this.config.quickLogLevel || const logLevel = this.config.quickLogLevel || // WFC specific
_.get(Config(), 'logging.rotatingFile.level') || _.get(Config(), 'logging.rotatingFile.level') || // ...or system setting
'info'; 'info'; // ...or default to info
this.logRingBuffer = new bunyan.RingBuffer({ limit : quickLogView.dimens.height || 24 }); this.logRingBuffer = new bunyan.RingBuffer({ limit : quickLogView.dimens.height || 24 });
Log.log.addStream({ Log.log.addStream({
@ -86,10 +87,7 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
return callback(null); return callback(null);
}, },
(callback) => { (callback) => {
return this._refreshStats(callback); return this._refreshAll(callback);
},
(callback) => {
return this._refreshNodeStatus(callback);
} }
], ],
err => { err => {
@ -136,6 +134,14 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
}, },
(callback) => { (callback) => {
return this._refreshQuickLog(callback); return this._refreshQuickLog(callback);
},
(callback) => {
this.updateCustomViewTextsWithFilter(
'main',
MciViewIds.main.customRangeStart,
this.stats
);
return callback(null);
} }
], ],
err => { err => {
@ -150,17 +156,19 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
const fileAreaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats); const fileAreaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats);
const sysMemStats = StatLog.getSystemStat(SysProps.SystemMemoryStats); const sysMemStats = StatLog.getSystemStat(SysProps.SystemMemoryStats);
const sysLoadStats = StatLog.getSystemStat(SysProps.SystemLoadStats); const sysLoadStats = StatLog.getSystemStat(SysProps.SystemLoadStats);
const lastLoginStats = StatLog.getSystemStat(SysProps.LastLogin);
const now = moment();
// Some stats we can just fill right away // Some stats we can just fill right away
this.stats = { this.stats = {
// Date/Time // Date/Time
date : moment().format(this.getDateFormat()), nowDate : now.format(this.getDateFormat()),
time : moment().format(this.getTimeFormat()), nowTime : now.format(this.getTimeFormat()),
dateTime : moment().format(this.getDateTimeFormat()), now : now.format(this._dateTimeFormat('now')),
// Current process (our Node.js service) // Current process (our Node.js service)
processUptimeSeconds : process.uptime(), processUptimeSeconds : process.uptime(),
// processUptime : moment.duration(process.uptime(), 'seconds').humanize(),
// Totals // Totals
totalCalls : StatLog.getSystemStatNum(SysProps.LoginCount), totalCalls : StatLog.getSystemStatNum(SysProps.LoginCount),
@ -174,22 +182,22 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
// totalDownloads : // totalDownloads :
// totalDownloadBytes : // totalDownloadBytes :
// :TODO: lastCaller
// :TODO: totalMemoryBytes, freeMemoryBytes
// :TODO: CPU info/averages/load
// Today's Stats // Today's Stats
callsToday : StatLog.getSystemStatNum(SysProps.LoginsToday), callsToday : StatLog.getSystemStatNum(SysProps.LoginsToday),
postsToday : StatLog.getSystemStatNum(SysProps.MessagesToday), postsToday : StatLog.getSystemStatNum(SysProps.MessagesToday),
// uploadsToday : uploadsToday : StatLog.getSystemStatNum(SysProps.FileUlTodayCount),
// uploadBytesToday : uploadBytesToday : StatLog.getSystemStatNum(SysProps.FileUlTodayBytes),
// downloadsToday : downloadsToday : StatLog.getSystemStatNum(SysProps.FileDlTodayCount),
// downloadBytesToday : downloadsBytesToday : StatLog.getSystemStatNum(SysProps.FileDlTodayBytes),
// Current // Current
// lastCaller : currentUserName : this.client.user.username,
// lastCallerDate currentUserRealName : this.client.user.getProperty(UserProps.RealName) || this.client.user.username,
// lastCallerTime lastLoginUserName : lastLoginStats.userName,
lastLoginRealName : lastLoginStats.realName,
lastLoginDate : moment(lastLoginStats.timestamp).format(this.getDateFormat()),
lastLoginTime : moment(lastLoginStats.timestamp).format(this.getTimeFormat()),
lastLogin : moment(lastLoginStats.timestamp).format(this._dateTimeFormat('lastLogin')),
totalMemoryBytes : sysMemStats.totalBytes, totalMemoryBytes : sysMemStats.totalBytes,
freeMemoryBytes : sysMemStats.freeBytes, freeMemoryBytes : sysMemStats.freeBytes,
@ -275,5 +283,10 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
return cb(null); return cb(null);
} }
_dateTimeFormat(element) {
const format = this.config[`${element}DateTimeFormat`];
return format || this.getDateFormat();
}
}; };