{"id":21584,"library":"mo-logs","title":"mo-logs","description":"Structured logging and exception handling library for Python, part of the mo-* family. Current version 8.703.26061. Provides structured logging with sensible defaults and a simple API. Release cadence is frequent and automated.","status":"active","version":"8.703.26061","language":"python","source_language":"en","source_url":"https://github.com/klahnakoski/mo-logs","tags":["logging","structured-logging","exception-handling","mo-logs"],"install":[{"cmd":"pip install mo-logs","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"Log","correct":"from mo_logs import Log"},{"note":"","wrong":"","symbol":"setup_logging","correct":"from mo_logs import setup_logging"},{"note":"","wrong":"","symbol":"Except","correct":"from mo_logs import Except"}],"quickstart":{"code":"from mo_logs import Log, setup_logging\nfrom mo_logs import constants\n\n# Setup logging (call once at startup)\nsetup_logging()\n\n# Basic logging\nLog.note(\"This is a log message\")\nLog.note(\"Message with {field}\", field=\"value\")\n\n# Warning\nLog.warning(\"This is a warning\")\n\n# Error handling\nfrom mo_logs import Except\ntry:\n    raise ValueError(\"something went wrong\")\nexcept ValueError as e:\n    error = Except.wrap(e)\n    Log.error(\"An error occurred: {error}\", error=error)\n\n# Set constants (like DEBUG flag)\nconstants.set({\"DEBUG\": True})","lang":"python","description":"Basic setup and usage of mo-logs for structured logging."},"warnings":[{"fix":"Use `from mo_logs import Log` instead of `from mo-logs import Log`.","message":"Import path changed: from `mo_logs` not `mo-logs`. Python package uses underscores, not hyphens.","severity":"breaking","affected_versions":"all"},{"fix":"Always call `setup_logging()` at application startup.","message":"Call `setup_logging()` before any logging to ensure configuration is applied. If omitted, logging defaults may not be set.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from mo_logs import Log`.","message":"Do not use `import mo-logs` directly; the package is not designed to be imported as a module. Always import specific symbols like `Log`.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `from mo_logs import start; start()` with `from mo_logs import setup_logging; setup_logging()`.","message":"The `start` function in `mo_logs` is deprecated. Use `setup_logging()` instead.","severity":"deprecated","affected_versions":">=5.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from mo_logs import Log` (with underscore).","cause":"Trying to import with hyphen instead of underscore.","error":"ModuleNotFoundError: No module named 'mo-logs'"},{"fix":"Use `from mo_logs import Log`.","cause":"Using `import mo_logs` then `mo_logs.Log` but the package may have changed export patterns.","error":"AttributeError: module 'mo_logs' has no attribute 'Log'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}