@nanocollective/nanocoder
Version:
A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter
55 lines • 1.55 kB
JavaScript
/**
* Logging system health check
*/
import { globalLogStorage } from '../../log-query/index.js';
import { loggerProvider } from '../../logger-provider.js';
const getLogger = () => loggerProvider.getLogger();
/**
* Calculate score based on status
*/
function calculateScore(status) {
if (status === 'fail')
return 0;
if (status === 'pass')
return 100;
if (status === 'warn')
return 50;
return 50; // default for unknown status
}
/**
* Check logging system health
*/
export function checkLoggingSystem(config) {
const startTime = performance.now();
const logCount = globalLogStorage.getEntryCount();
const thresholds = config.thresholds.logging;
// Check if logging system is functional
let status = 'pass';
let message = 'Logging system is healthy';
const details = {
totalEntries: logCount,
isConfigReloaderActive: false,
hasLogger: !!getLogger(),
};
if (!getLogger()) {
status = 'fail';
message = 'Logger is not initialized';
}
else if (logCount === 0 && process.uptime() > 60) {
status = 'warn';
message = 'No log entries detected';
}
return {
name: 'logging-system',
status,
score: calculateScore(status),
duration: performance.now() - startTime,
message,
details,
threshold: {
warning: thresholds.logRateWarning,
critical: thresholds.logRateCritical,
},
};
}
//# sourceMappingURL=logging-check.js.map