Fix import paths and remove organ metaphors
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
- Update all `from storage.` imports to `from dss.storage.` - Update `from config import config` to use `dss.settings` - Update `from auth.` imports to `from dss.auth.` - Update health check to use `dss.mcp.handler` - Fix SmartMerger import (merger.py not smart_merger.py) - Fix TranslationDictionary import path - Fix test assertion for networkx edges/links - Remove organ/body metaphors from: - API server health check - CLI status command and help text - Admin UI logger and error handler 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,35 +1,28 @@
|
||||
/**
|
||||
* DSS Logger - Component Brain Consciousness System
|
||||
* DSS Logger - Structured Logging System
|
||||
*
|
||||
* The DSS brain uses this logger to become conscious of what's happening.
|
||||
* Log levels represent the component's level of awareness and concern.
|
||||
* Provides structured logging with categories and levels for the DSS admin UI.
|
||||
*
|
||||
* Framework: DSS Component Framework
|
||||
* See: docs/DSS_ORGANISM_GUIDE.md#brain
|
||||
*
|
||||
* Log Categories (Organ Systems):
|
||||
* 'heart' - ❤️ Database operations and data persistence
|
||||
* 'brain' - 🧠 Validation, analysis, and decision making
|
||||
* 'nervous' - 🔌 API calls, webhooks, communication
|
||||
* 'digestive' - 🍽️ Data ingestion, parsing, transformation
|
||||
* 'circulatory' - 🩸 Design token flow and distribution
|
||||
* 'metabolic' - ⚡ Style-dictionary transformations
|
||||
* 'endocrine' - 🎛️ Theme system and configuration
|
||||
* 'immune' - 🛡️ Validation, error detection, security
|
||||
* 'sensory' - 👁️ Asset loading, Figma perception
|
||||
* 'skin' - 🎨 UI rendering, Storybook output
|
||||
* 'skeleton' - 🦴 Schema and structure validation
|
||||
*
|
||||
* Provides structured logging with biological awareness levels and optional remote logging.
|
||||
* Log Categories:
|
||||
* 'storage' - Database operations and data persistence
|
||||
* 'validation' - Validation, analysis, and decision making
|
||||
* 'api' - API calls, webhooks, communication
|
||||
* 'parser' - Data ingestion, parsing, transformation
|
||||
* 'tokens' - Design token flow and distribution
|
||||
* 'transform' - Style-dictionary transformations
|
||||
* 'config' - Theme system and configuration
|
||||
* 'security' - Validation, error detection, security
|
||||
* 'assets' - Asset loading, Figma integration
|
||||
* 'ui' - UI rendering, Storybook output
|
||||
* 'schema' - Schema and structure validation
|
||||
*/
|
||||
|
||||
// Component awareness levels - how conscious is the system?
|
||||
const LOG_LEVELS = {
|
||||
DEBUG: 0, // 🧠 Deep thought - brain analyzing internal processes
|
||||
INFO: 1, // 💭 Awareness - component knows what's happening
|
||||
WARN: 2, // ⚠️ Symptom - component detected something unusual
|
||||
ERROR: 3, // 🛡️ Immune alert - component detected a threat
|
||||
NONE: 4 // 🌙 Sleep - component is silent
|
||||
DEBUG: 0,
|
||||
INFO: 1,
|
||||
WARN: 2,
|
||||
ERROR: 3,
|
||||
NONE: 4
|
||||
};
|
||||
|
||||
class Logger {
|
||||
@@ -76,23 +69,22 @@ class Logger {
|
||||
this.logs.shift();
|
||||
}
|
||||
|
||||
// Console output with component awareness emojis
|
||||
const levelEmojis = {
|
||||
DEBUG: '🧠', // Brain thinking deeply
|
||||
INFO: '💭', // Component aware
|
||||
WARN: '⚠️', // Symptom detected
|
||||
ERROR: '🛡️' // Immune alert - threat detected
|
||||
const levelIcons = {
|
||||
DEBUG: '[D]',
|
||||
INFO: '[I]',
|
||||
WARN: '[W]',
|
||||
ERROR: '[E]'
|
||||
};
|
||||
|
||||
const colors = {
|
||||
DEBUG: 'color: #666; font-style: italic', // Gray, thoughtful
|
||||
INFO: 'color: #2196F3; font-weight: bold', // Blue, informative
|
||||
WARN: 'color: #FF9800; font-weight: bold', // Orange, warning
|
||||
ERROR: 'color: #F44336; font-weight: bold' // Red, critical
|
||||
DEBUG: 'color: #666; font-style: italic',
|
||||
INFO: 'color: #2196F3; font-weight: bold',
|
||||
WARN: 'color: #FF9800; font-weight: bold',
|
||||
ERROR: 'color: #F44336; font-weight: bold'
|
||||
};
|
||||
|
||||
const emoji = levelEmojis[level] || '🔘';
|
||||
const prefix = `${emoji} [${category}]`;
|
||||
const icon = levelIcons[level] || '[?]';
|
||||
const prefix = `${icon} [${category}]`;
|
||||
const style = colors[level] || '';
|
||||
|
||||
if (data) {
|
||||
@@ -120,56 +112,49 @@ class Logger {
|
||||
}
|
||||
|
||||
/**
|
||||
* 🧠 DEBUG - Brain's deep thoughts
|
||||
* Internal analysis and detailed consciousness
|
||||
* DEBUG - Detailed internal information
|
||||
*/
|
||||
debug(category, message, data) {
|
||||
this._log('DEBUG', category, message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 💭 INFO - Component awareness
|
||||
* The system knows what's happening, stays informed
|
||||
* INFO - General information
|
||||
*/
|
||||
info(category, message, data) {
|
||||
this._log('INFO', category, message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* ⚠️ WARN - Symptom detection
|
||||
* Component detected something unusual but not critical
|
||||
* WARN - Warning, something unusual detected
|
||||
*/
|
||||
warn(category, message, data) {
|
||||
this._log('WARN', category, message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 🛡️ ERROR - Immune alert
|
||||
* Component detected a threat - critical consciousness
|
||||
* ERROR - Error, something went wrong
|
||||
*/
|
||||
error(category, message, data) {
|
||||
this._log('ERROR', category, message, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 📜 Get recent consciousness records
|
||||
* Retrieve the component's recent thoughts and awareness
|
||||
* Get recent log entries
|
||||
*/
|
||||
getRecentLogs(count = 50) {
|
||||
return this.logs.slice(-count);
|
||||
}
|
||||
|
||||
/**
|
||||
* 🧠 Clear the mind
|
||||
* Erase recent consciousness logs
|
||||
* Clear all logs
|
||||
*/
|
||||
clear() {
|
||||
this.logs = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 📤 Export consciousness
|
||||
* Save the component's awareness to a file for analysis
|
||||
* Export logs to file
|
||||
*/
|
||||
export() {
|
||||
const dataStr = JSON.stringify(this.logs, null, 2);
|
||||
@@ -185,13 +170,11 @@ class Logger {
|
||||
}
|
||||
|
||||
/**
|
||||
* 🧠 ORGANISM CONSCIOUSNESS
|
||||
* Create the DSS component's brain - a singleton logger that tracks all awareness
|
||||
* DSS Logger singleton
|
||||
*/
|
||||
const logger = new Logger('DSS', 'INFO');
|
||||
|
||||
// Set log level from localStorage or URL param
|
||||
// Allow tuning the component's consciousness level (awareness sensitivity)
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const logLevel = urlParams.get('log') || localStorage.getItem('dss_log_level') || 'INFO';
|
||||
logger.setLevel(logLevel.toUpperCase());
|
||||
|
||||
Reference in New Issue
Block a user