Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions addons/source-python/packages/source-python/core/__init__.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
from configobj import ConfigObj

# Source.Python Imports
# Loggers
from loggers import _sp_logger
# Paths
from paths import GAME_PATH

Expand Down Expand Up @@ -89,9 +87,6 @@
# Get the platform the server is on
PLATFORM = system().lower()

# Get the sp.core logger
core_logger = _sp_logger.core


# =============================================================================
# >> CLASSES
Expand Down
2 changes: 1 addition & 1 deletion addons/source-python/packages/source-python/core/command/__init__.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
# Commands
from commands.typed import TypedServerCommand
# Core
from core import core_logger
from core import create_checksum
from core import SOURCE_ENGINE_BRANCH
from core.logger import core_logger
from core.update import do_full_update
from core.version import get_last_successful_build_number
from core.version import is_unversioned
Expand Down
17 changes: 17 additions & 0 deletions addons/source-python/packages/source-python/core/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ../core/logger.py

"""Provides the Source.Python core logger."""

# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
# Loggers
from loggers import _sp_logger


# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Get the sp.core logger
core_logger = _sp_logger.core
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Source.Python Imports
# Core
from core import core_logger
from core.logger import core_logger
# Paths
from paths import GAME_PATH
from paths import CFG_PATH
Expand Down
2 changes: 1 addition & 1 deletion addons/source-python/packages/source-python/core/update.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# Source.Python Imports
# Core
from core import PLATFORM
from core import core_logger
from core import SOURCE_ENGINE_BRANCH
from core.logger import core_logger
# Paths
from paths import ADDONS_PATH
from paths import GAME_PATH
Expand Down
8 changes: 7 additions & 1 deletion addons/source-python/packages/source-python/loggers.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from logging import getLogger

# Source.Python Imports
# Core
from core import AutoUnload
# Cvars
from cvars import ConVar
# Paths
Expand Down Expand Up @@ -314,7 +316,7 @@ def logger(self):
return self._logger


class LogManager(_LogInstance):
class LogManager(AutoUnload, _LogInstance):
"""Main log class used as a root to create children instances."""

def __init__(
Expand Down Expand Up @@ -388,6 +390,10 @@ def areas(self):
"""
return self._areas.get_int()

def _unload_instance(self):
"""Remove the logger from logging manager."""
self.logger.manager.loggerDict.pop(self.logger.name, None)

# Set the core ConVars
_level = ConVar(
'sp_logging_level', '0', 'The Source.Python base logging level')
Expand Down