turnoff logging for tui mode

This commit is contained in:
rajeevrajeshuni 2025-11-30 13:45:57 +05:30
parent ad6bdd2be3
commit 0a644999c5
2 changed files with 5 additions and 4 deletions

View file

@ -5,7 +5,7 @@ import cognee.cli.echo as fmt
from cognee.cli.exceptions import CliCommandException
from cognee.cli.tui.home_screen import HomeScreen
from textual.app import App
from cognee.shared.logging_utils import setup_logging
class TuiCommand(SupportsCliCommand):
@ -40,9 +40,9 @@ class TuiCommand(SupportsCliCommand):
"""Push the home screen on mount."""
self.push_screen(HomeScreen())
setup_logging(enable_console_logging=False)
app = CogneeTUI()
app.run()
fmt.success("TUI exited successfully!")
except ImportError:
raise CliCommandException(
"Textual is not installed. Install with: pip install textual",

View file

@ -285,7 +285,7 @@ def cleanup_old_logs(logs_dir, max_files):
return False
def setup_logging(log_level=None, name=None):
def setup_logging(log_level=None, name=None, enable_console_logging=True):
"""Sets up the logging configuration with structlog integration.
Args:
@ -465,7 +465,8 @@ def setup_logging(log_level=None, name=None):
root_logger = logging.getLogger()
if root_logger.hasHandlers():
root_logger.handlers.clear()
root_logger.addHandler(stream_handler)
if enable_console_logging:
root_logger.addHandler(stream_handler)
# Note: root logger needs to be set at NOTSET to allow all messages through and specific stream and file handlers
# can define their own levels.