def get_log(self, log_name: str) -> CommonLog:
     """ Get a log for a log name. """
     _log = CommonLogRegistry().register_log(
         '{}_S4CLVanillaLog'.format(log_name), 'log', 'vanilla_logs')
     _log.enable()
     self.logs.append(_log)
     return _log
Esempio n. 2
0
from sims4communitylib.services.common_service import CommonService
from sims4communitylib.utils.common_injection_utils import CommonInjectionUtils
from sims4communitylib.utils.common_log_registry import CommonLogRegistry
# ReadTheDocs
ON_RTD = os.environ.get('READTHEDOCS', None) == 'True'

if not ON_RTD:
    from services.persistence_service import SaveGameData
else:

    class SaveGameData:
        pass


log = CommonLogRegistry().register_log(ModInfo.get_identity(), 'thing')
log.enable()


class CommonSaveEventDispatcher(CommonService):
    """A service that dispatches save file save/load events.

    .. warning:: Do not use this service directly to listen for events!\
        Use the :class:`.CommonEventRegistry` to listen for dispatched events.

    """
    def __init__(self) -> None:
        self._current_save_slot_guid = None

    def _on_game_save(self, save_game_data: SaveGameData):
        CommonEventRegistry.get().dispatch(S4CLSaveSavedEvent(save_game_data))