"""Tests for logging system."""

import pytest
import logging
from pathlib import Path
from unittest.mock import patch
from src.core.logger import setup_logging, get_logger


class TestLogger:
    """Tests for logging system."""
    
    def test_logger_setup(self, test_log_dir):
        """Test logger setup."""
        with patch('src.core.logger.get_config') as mock_get_config:
            mock_config = mock_get_config.return_value
            mock_config.get.side_effect = lambda key, default=None: {
                'logging.dir': str(test_log_dir),
                'logging.retention_days': 30,
                'logging.level': 'INFO'
            }.get(key, default)
            
            setup_logging()
            logger = get_logger('test')
            assert logger is not None
            assert isinstance(logger, logging.Logger)
    
    def test_logger_get(self):
        """Test getting logger instance."""
        logger = get_logger('test_module')
        assert logger is not None
        assert logger.name == 'test_module'
    
    def test_logger_levels(self):
        """Test different log levels."""
        logger = get_logger('test')
        # Should not raise exceptions
        logger.debug("Debug message")
        logger.info("Info message")
        logger.warning("Warning message")
        logger.error("Error message")
        logger.critical("Critical message")

