28 Commits
Author SHA1 Message Date
Dariusz L ddc5333bd2 refactor: unify model data contracts 2026-08-21 23:10:26 +02:00
Dariusz L 29d4691a34 refactor: unify logger context badges 2026-08-05 13:43:22 +02:00
Dariusz L 21822224b7 Update AzLogs to 2.0.1 and centralize rotated log filename handling 2026-07-24 22:01:41 +02:00
Dariusz L 20a83c7262 refactor: improve code quality and consistency across backend modules 2026-07-16 11:00:45 +02:00
Dariusz L 38dc3e4474 refactor: centralize shared utilities, normalize imports, and configure project linting 2026-07-16 10:52:06 +02:00
Dariusz L 0cecfab2a0 Switch default log level from DEBUG to ERROR across backend, frontend, and options defaults 2026-07-06 16:05:50 +02:00
Dariusz L f1e863e495 Normalize module name when __name__ contains OS path separators
ComfyUI may set __name__ to hybrid OS-path values (e.g. 'E:\\...\\comfyui-model-resolver.core.sources.model_list'), which broke the existing split-by-dot logic.

This adds a pre-normalization step that converts path separators to dots, strips drive letters and .py extensions, so _normalize_module_name reliably falls back to DEFAULT_MODULE for unknown path-derived values rather than miscounting segments.
2026-06-30 22:33:41 +02:00
Dariusz L 63518e18b4 fix(logger): reset loggers in configure() to apply new config 2026-06-30 22:16:53 +02:00
Dariusz L c6441aa92e feat: add FATAL log level, refactor logging colors and stacklevel
- Add FATAL (50) to LogLevel enum, LEVEL_MAP, and LEVEL_THEME (bright red #E74C3C)
- Drop legacy COLORS dict in favor of LEVEL_THEME RGB values + ANSI_RESET
- Replace hard-coded stacklevel=4 with _INTERNAL_FRAMES constant so caller
  location is always correct regardless of call-chain depth
- Simplify _normalize_module_name by removing redundant path normalization
- Add fatal() to ModuleLogger, AzLogsLogger, and module-level API
- Lazily init _log in path_utils via _get_log() to avoid circular imports
2026-06-30 22:07:15 +02:00
Dariusz L b59be44935 refactor(log): remove legacy standalone log functions and consolidate exports
- Drop manual log_debug/info/warn/error/exception stubs from core/log_system/log_funcs.py
- Remove stale re-exports of create_module_logger/logger from core/__init__.py
- Add core/log_system/__init__.py as the single public entry point for the log system
- Update huggingface-author-index metadata
2026-06-30 21:34:25 +02:00
Dariusz L a7f5f70e3c refactor: migrate logging from global functions to per-module loggers
Replace global log_* wrapper functions with create_module_logger(__name__)
instances across the codebase, enabling proper module-level logger
namespacing. Simplifies core/log_system/log_funcs.py by removing legacy
_normalize_module_path and cleaning up _normalize_module_name. Bumps
log_system config to 2.0.0 and introduces PROJECT_ALIASES for cleaner
log module prefix stripping.
2026-06-30 21:24:33 +02:00
Dariusz L a04c294c55 Bump log_system version to 1.5.7; conditionally resolve use_colors from env/config 2026-06-30 06:00:21 +02:00
Dariusz L 5301bbbb6d Improve log system robustness with safer handlers and simplified color config 2026-06-30 05:35:01 +02:00
Dariusz L cf90841789 feat(log_system/logger): enable Windows console ANSI colors and fix color formatting 2026-06-30 04:28:33 +02:00
Dariusz L a4d5bd4c5c feat(logging): add frontend/backend log controls, unify console logging
- Add frontend_logs_enabled/frontend_log_level and backend_logs_enabled/backend_log_level
  toggles and selectors in the Options panel (web/resolver/views/options_methods.js)
- Sync frontend logging settings from localStorage / server settings into the
  frontend logger on startup and settings load (download_target_methods.js)
- Apply backend logging settings from server settings in the Python backend
  (__init__.py), loading control state on startup and after saves
- Make frontend Logger resilient to stored configs that lack an 'enabled' flag
  and to legacy/invalid moduleSettings levels (logger.js)
- Guard default module logger level initialization against undefined settings
  (log_funcs.js)
- Replace scattered console.log/usages with module-level log.debug calls across
  resolve_download_methods.js, model_resolver.js, and workflow_state_methods.js
- Bump log system package version to 1.5.6 (core + web)
2026-06-17 01:51:29 +02:00
Dariusz L 5a8e68655f refactor: rename Model Linker to Model Resolver
Replace all link dialog terminology with resolver terminology
throughout the codebase, including module names, CSS classes,
IDs, JS variables, SVG gradient IDs, and log module names.
Remove the old web/linker/ tree and introduce the new web/resolver/
tree with parallel structure. Also replace core/linker.py with
core/resolver.py.
2026-06-05 05:53:39 +02:00
Dariusz L ca5de099b0 Add include_brackets option to ColoredFormatter
Adds a new include_brackets parameter to ColoredFormatter that controls
whether square brackets wrap timestamps, root labels, and log level names
in formatted log output. When True, brackets are applied; when False
(the default for AzLogsLogger), brackets are omitted for cleaner output.
This allows callers like AzLogsLogger to opt-in to bracket formatting
independently via the constructor.
2026-05-20 02:10:20 +02:00
Dariusz L 780ef9d0ef refactor(log_system): bump to v1.5.2 — bracket-wrapped console output, shared file handlers, and milliseconds toggle
Console output (ColoredFormatter):
- Level name is now wrapped in [LEVEL] and left-padded via _format_level.
- Timestamp and root-label segments are individually bracket-wrapped, keeping
  plain-output layout consistent with coloured output.
- Separator between fields is colourised (colour code derived from level theme)
  so the table structure remains readable.
- New include_milliseconds init flag controls whether a fractional-second suffix
  is appended to the timestamp; _format_time respects it.
- _display_logger_name unchanged; _split_logger_name still decomposes dotted names
  into root / detail parts.

File logging (AzLogsLogger):
- file_handlers dict introduced to cache one RotatingFileHandler per top-level
  root module, preventing duplicate handlers when multiple sub-modules log to
  the same file (_get_file_handler / _get_log_file / _root_module_name).
- File handler formatter upgraded from a bare logging.Formatter to ColoredFormatter
  (colours off, milliseconds on, datefmt hard-coded to
  '%Y-%m-%d %H:%M:%S') so file output carries the same column structure as
  the console formatter.
- reset_loggers method properly removes and closes all handlers (StreamHandler
  and RotatingFileHandler) from every configured logger before clearing
  self.loggers and self.file_handlers, allowing _get_logger to be called again
  with fresh settings.
- set_file_logging now delegates to reset_loggers instead of simply clearing
  the loggers dict.
2026-05-20 01:34:51 +02:00
Dariusz L 0c7c76b263 refactor(log_system): bump version to 1.5.1; add ruff noqa T201 to log_funcs and logger
- Increment log_system version from 1.5.0 to 1.5.1 in all module docstrings
- Add # ruff: noqa: T201 to log_funcs.py and logger.py to suppress
  ruff T201 (favored print() usage) warning in logging utility modules
2026-05-19 07:59:16 +02:00
Dariusz L bcd947e37d feat(log_system): add USE_COLORS config option for ANSI console color support
- Bump version to 1.5.0 in config.py, log_funcs.py, and logger.py
- Add USE_COLORS = True to core/log_system/config.py
- Import USE_COLORS in log_funcs.py and pass it to the logger context as
  use_colors, honouring AZLOGS_USE_COLORS env var when set
2026-05-19 07:35:52 +02:00
Dariusz L 5b4d82f26f feat(logger): add colored log level badges, timestamps, and logger name highlighting
- Introduce LEVEL_THEME mapping per-level RGB colors for DEBUG/INFO/WARN/ERROR
- Add TIME_BG background color for timestamp blocks
- Refactor _color_level into _color_level_badge: bold + background color badge
- Add _color_timestamp, _color_root_label, _color_separator, _color_message helpers
- Format output as: <level-badge> <timestamp> <root-label> <message> <source>
- Split logger name into root/detail via _split_logger_name; show only detail in source field
- Non-colored fallback path uses same structured layout without ANSI codes
2026-05-19 07:28:47 +02:00
Dariusz L 367a6d208a refactor(logging): reformat log output, adjust stacklevel and field widths
- Change logging stacklevel from 3 to 4 in all log helper functions
  (create_module_logger, log_debug, log_info, log_warn, log_error) to
  correctly attribute the caller location in stack output.

- Reduce level_field_width from 9 to 5 (e.g. ERROR→5 chars) and set
  source_field_width to 0 so source column auto-sizes to its content.

- Add MESSAGE color (cyan) for log message highlighting in colored output.

- Extract four helper methods from ColoredFormatter.format:
  _display_logger_name  — strips the 'azlogs.' namespace prefix
  _display_level_name   — normalises WARNING → WARN for compact display
  _format_time          — builds HH:MM:SS.mmm timestamps
  _color_level          — applies bold+color to the level token

- Simplify format() to assemble [HH:MM:SS.mmm] LVL (logger:line): message
  with the new helpers applied inline.
2026-05-19 06:44:00 +02:00
Dariusz L 34e3d73f3f refactor(logging): add configurable field widths for log level and source
- Set default level/source field widths to 0 (no extra spacing) in DEFAULT_CONFIG
- Add level_field_width and source_field_width parameters to ColoredFormatter
- Pad/center level tag and ljust source tag ([name:lineno]) consistently
- Add _field_width() helper to safely convert config values to non-negative ints
- Pass config widths through to ColoredFormatter in AzLogsLogger setup
- Set LOG_MODULE_NAME to 'MLinker' in config.py
2026-05-17 03:47:24 +02:00
Dariusz L eccf6e9d1e refactor: overhaul logging system across backend and web frontend
- Switch __init__.py to use create_module_logger(); remove inline logging.getLogger calls
- Rewrite log_funcs.py: introduce module-name normalization (_normalize_module_name/_normalize_module_path/_resolve_module_name), ModuleLogger class, and global log-level switching (set_global_level replaces per-module set_module_level)
- Enhance logger.py: show [name:lineno] in console prefix, sanitize log file names for safe filesystem paths, wrap RotatingFileHandler setup with OSError handling to fall back to console-only logging, pass stacklevel through log() and propagate kwargs to exception()
- Update web/log_system/logger.js: dispatch to level-specific console methods (debug/info/warn/error) via CONSOLE_METHODS map; replace truncated t/m/l/a localStorage schema with serializeLogEntry/deserializeLogEntry (backward-compatible with short keys); load saved logs on construction via loadLogs()
2026-05-17 03:38:23 +02:00
Dariusz L a288b26b66 refactor(logging): AzLogs v1.4.1 with dynamic storage and utilities
Enhance logging system with configurable module names and dynamic
localStorage keys to avoid conflicts between multiple plugin instances.

- Add LOG_MODULE_NAME and DEFAULT_LOGGER_NAME to web/log_system/config.js
- Update logger.js to use dynamic storage keys based on module name
- Change window property from ResolutionMasterLogger to dynamic key
- Add PyDoc metadata to core/log_system/config.py
- Add JSDoc metadata blocks to all web log_system files

Reorganize web utilities:
- Move css-loader.js from web/ to web/utils/
- Add ErrorHandler.js for centralized error handling
- Add ResourceManager.js for stylesheet and template loading

 rename: web/css-loader.js => web/utils/css-loader.js
2026-05-11 02:41:30 +02:00
Dariusz L 3687d26f17 Bump log version; use project root for module name
Bump logging version to 1.4.1 and improve module name detection by adding _find_project_root in log_funcs to locate the repository root (searches for a .git directory) and use its basename when LOG_MODULE_NAME is not set, with a fallback to the previous behavior. Also update the same version string in logger.py. Additionally, comment out two noisy debug log lines in core/scanner.py to reduce verbose output when directories are missing or after scanning.
2026-04-22 03:44:41 +02:00
Dariusz L 5fa6b2a731 Delegate logger methods to central log() and log init errors
Refactor AzLogsLogger instance methods (debug/info/warn/error/exception) and the module-level helper functions to call the central logger.log(...) with the appropriate LogLevel, and ensure exception() passes exc_info=True. Also add a standard library logger in core/log_system/log_funcs.py and emit an error if importing the custom logger fails to aid diagnosis.
2026-04-22 03:28:40 +02:00
Dariusz L e8b49dd184 Add AzLogs logging system and integrate
Introduce a new logging subsystem under core/log_system (logger.py, config.py, log_funcs.py) implementing AzLogs (LogLevel enum, colored console output, optional file rotation) and a lightweight wrapper (log_debug/info/warn/error/exception) with safe fallback when AzLogs is unavailable. Integrate these log functions across many core modules (downloader, linker, matcher, scanner, workflow_analyzer, workflow_updater, sources and related files) and export logger and helper log functions from core.__init__. Replace several direct logging calls in linker with the new log_* helpers and update core.__init__ exports. Also include small code style and robustness tweaks (path/filename normalization, JSON/file handling, minor refactors and formatting fixes) to improve matching and model-list/popular lookups.
2026-04-21 23:51:46 +02:00