feat: migrate from loguru to structlog (#9321)
* refactor: Enhance logging configuration with structured logging and buffer support * feat: Add structlog dependency for enhanced logging support * refactor: Update ruff dependency to version 0.12.7 and remove unused pylint references * Refactor logging imports to use langflow.logging.logger - Replaced instances of loguru logger with langflow.logging.logger across multiple files. - Updated logging calls to use asynchronous methods where applicable (e.g., await logger.awarning). - Ensured consistent logging practices throughout the codebase by standardizing the logger import. * refactor: Add missing docstring rule to ruff configuration * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes * fix: update logger calls to use async methods in DatabaseService * fix: update logger calls to use async methods in initialize_database and session_getter * fix: update logger calls to use async methods in LangflowRunnerExperimental * fix: update logger calls to use async methods across various services * Refactor logging to use asynchronous logger methods across multiple components - Updated logging calls in to use async logger methods for error handling and debugging. - Modified to utilize async logging for error messages during file deletion. - Changed logging in , , and other agent-related files to use async methods for error and debug messages. - Refactored logging in various components including , , , and others to ensure consistent use of async logging. - Updated , , and to replace synchronous logging with asynchronous counterparts. - Ensured all logging changes maintain the original message structure while enhancing performance with async capabilities. * [autofix.ci] apply automated fixes * fix: update logger calls to use async methods in various components * feat: add InterceptHandler to route standard logging messages to structlog * refactor: remove async_file parameter from logger configuration * fix: correct log level mapping and enhance log rotation validation * refactor: remove unused logging import and streamline schema imports * Refactor logging in AssemblyAI components and other modules to use exc_info for better error tracing - Updated logging statements in AssemblyAI components (e.g., assemblyai_get_subtitles, assemblyai_lemur, assemblyai_list_transcripts, etc.) to use logger.debug with exc_info=True for improved error context. - Modified logging in various helper and utility functions to enhance error reporting. - Ensured consistent logging practices across the codebase for better maintainability and debugging. * refactor: remove InterceptHandler from logger configuration to avoid recursion * refactor: enhance test coverage for logger module with comprehensive test cases * refactor: add rule to ignore mutable objects without __hash__ method in linter * fix various lint issues * refactor: update function signatures to improve clarity and consistency * refactor: streamline import statements and enhance response handling in voice mode * refactor: simplify lifespan cleanup logic * refactor: remove unused caplog fixture and improve graph test clarity * fix: specify logger type as BoundLogger for clarity * [autofix.ci] apply automated fixes * refactor: remove unused logger and correct return statement in arun_flow_from_json * refactor: update logger usage to support async methods in tests * fix: correct datetime bounds for hypothesis strategies to avoid timezone issues * fix: update warning message for invalid string input type in tests * refactor: simplify message handling tests by removing database session mocks * refactor: remove redundant comment from test_max_size function in test_logger.py * fix: update patch target for DEV setting in remove_exception_in_production test * fix: update patch target for DEV setting in remove_exception_in_production test * fix: update patching of DEV setting in remove_exception_in_production tests to use module import --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
3ecf9640b7
commit
a1629a7553
203 changed files with 2038 additions and 1250 deletions
|
|
@ -113,8 +113,6 @@ dependencies = [
|
|||
"pydantic-ai>=0.0.19",
|
||||
"smolagents>=1.8.0",
|
||||
"apify-client>=1.8.1",
|
||||
"pylint>=3.3.4",
|
||||
"ruff>=0.9.7",
|
||||
"langchain-graph-retriever==0.6.1",
|
||||
"graph-retriever==0.6.1",
|
||||
"ibm-watsonx-ai>=1.3.1",
|
||||
|
|
@ -127,6 +125,7 @@ dependencies = [
|
|||
"docling_core>=2.36.1",
|
||||
"filelock>=3.18.0",
|
||||
"jigsawstack==0.2.7",
|
||||
"structlog>=25.4.0",
|
||||
"aiosqlite==0.21.0",
|
||||
"fastparquet>=2024.11.0",
|
||||
"traceloop-sdk>=0.43.1",
|
||||
|
|
@ -138,7 +137,7 @@ dev = [
|
|||
"types-redis>=4.6.0.5",
|
||||
"ipykernel>=6.29.0",
|
||||
"mypy>=1.11.0",
|
||||
"ruff>=0.9.7,<0.10",
|
||||
"ruff>=0.12.7",
|
||||
"httpx>=0.27.0",
|
||||
"pytest>=8.2.0",
|
||||
"types-requests>=2.32.0",
|
||||
|
|
@ -298,7 +297,9 @@ ignore = [
|
|||
"TD002", # Missing author in TODO
|
||||
"TD003", # Missing issue link in TODO
|
||||
"TRY301", # A bit too harsh (Abstract `raise` to an inner function)
|
||||
|
||||
"PLC0415", # Inline imports
|
||||
"D10", # Missing docstrings
|
||||
"PLW1641", # Object does not implement `__hash__` method (mutable objects shouldn't be hashable)
|
||||
# Rules that are TODOs
|
||||
"ANN",
|
||||
]
|
||||
|
|
@ -308,6 +309,7 @@ external = ["RUF027"]
|
|||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"scripts/*" = ["D1", "INP", "T201"]
|
||||
"src/backend/base/langflow/alembic/versions/*" = ["INP001", "D415", "PGH003"]
|
||||
"src/backend/tests/*" = [
|
||||
"D1",
|
||||
"PLR2004",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue