Added event logger
Some checks reported warnings
Deploy staging on push / on-push-deploy_sh-edraft (push) Has been cancelled
Some checks reported warnings
Deploy staging on push / on-push-deploy_sh-edraft (push) Has been cancelled
This commit is contained in:
parent
b0fb12f841
commit
69882af0bd
@ -1 +1 @@
|
||||
Subproject commit 4669bf7c43c7aec368a1a1917ea92038c007944f
|
||||
Subproject commit be5b15f227e7b2b12cc73c0edd7f6fa95dbdd52f
|
@ -15,6 +15,7 @@ from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
from bot_core.logging.database_logger import DatabaseLogger
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_core.logging.message_logger import MessageLogger
|
||||
from bot_core.logging.task_logger import TaskLogger
|
||||
from bot_data.db_context import DBContext
|
||||
@ -45,6 +46,7 @@ class Startup(StartupABC):
|
||||
services.add_singleton(CustomFileLoggerABC, DatabaseLogger)
|
||||
services.add_singleton(CustomFileLoggerABC, MessageLogger)
|
||||
services.add_singleton(CustomFileLoggerABC, TaskLogger)
|
||||
services.add_singleton(CustomFileLoggerABC, EventLogger)
|
||||
|
||||
if self._feature_flags.get_flag(FeatureFlagsEnum.api_module):
|
||||
services.add_singleton(CustomFileLoggerABC, ApiLogger)
|
||||
|
@ -1,20 +1,18 @@
|
||||
import asyncio
|
||||
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import OnReadyABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from cpl_translation import TranslatePipe
|
||||
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.environment_variables import MAINTENANCE
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
|
||||
|
||||
class CoreExtensionOnReadyEvent(OnReadyABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
t: TranslatePipe,
|
||||
|
@ -1,15 +1,15 @@
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import OnReadyABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from cpl_translation import TranslatePipe
|
||||
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
|
||||
|
||||
class CoreOnReadyEvent(OnReadyABC):
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
t: TranslatePipe,
|
||||
|
15
bot/src/bot_core/logging/event_logger.py
Normal file
15
bot/src/bot_core/logging/event_logger.py
Normal file
@ -0,0 +1,15 @@
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.environment import ApplicationEnvironmentABC
|
||||
from cpl_core.time import TimeFormatSettings
|
||||
|
||||
from bot_core.abc.custom_file_logger_abc import CustomFileLoggerABC
|
||||
|
||||
|
||||
class EventLogger(CustomFileLoggerABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
time_format: TimeFormatSettings,
|
||||
env: ApplicationEnvironmentABC,
|
||||
):
|
||||
CustomFileLoggerABC.__init__(self, "Task", config, time_format, env)
|
@ -1,7 +1,6 @@
|
||||
import datetime
|
||||
import uuid
|
||||
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_core.time import TimeFormatSettings
|
||||
from cpl_discord.events.on_command_error_abc import OnCommandErrorABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
@ -12,13 +11,14 @@ from discord.ext.commands import Context, CommandError
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.exception.check_error import CheckError
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.model.technician_config import TechnicianConfig
|
||||
|
||||
|
||||
class BaseOnCommandErrorEvent(OnCommandErrorABC):
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
messenger: MessageServiceABC,
|
||||
tech_settings: TechnicianConfig,
|
||||
|
@ -1,10 +1,10 @@
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import OnGuildJoinABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from discord import Guild
|
||||
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.model.server import Server
|
||||
@ -14,7 +14,7 @@ from bot_data.service.seeder_service import SeederService
|
||||
class BaseOnGuildJoinEvent(OnGuildJoinABC):
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
servers: ServerRepositoryABC,
|
||||
server_config: ServerConfigRepositoryABC,
|
||||
|
@ -4,14 +4,15 @@ from typing import Union
|
||||
import discord
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import OnMemberJoinABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from cpl_translation import TranslatePipe
|
||||
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.abc.permission_service_abc import PermissionServiceABC
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
|
||||
@ -20,14 +21,13 @@ from bot_data.model.known_user import KnownUser
|
||||
from bot_data.model.server_config import ServerConfig
|
||||
from bot_data.model.user import User
|
||||
from bot_data.model.user_joined_server import UserJoinedServer
|
||||
from bot_core.abc.permission_service_abc import PermissionServiceABC
|
||||
|
||||
|
||||
class BaseOnMemberJoinEvent(OnMemberJoinABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
messenger: MessageServiceABC,
|
||||
permissions: PermissionServiceABC,
|
||||
db: DatabaseContextABC,
|
||||
|
@ -4,12 +4,12 @@ from typing import Union
|
||||
import discord
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import OnMemberRemoveABC
|
||||
from cpl_translation import TranslatePipe
|
||||
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
@ -20,7 +20,7 @@ class BaseOnMemberRemoveEvent(OnMemberRemoveABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
db: DatabaseContextABC,
|
||||
message_service: MessageServiceABC,
|
||||
users: UserRepositoryABC,
|
||||
|
@ -4,6 +4,7 @@ from cpl_discord.service import DiscordBotServiceABC
|
||||
from discord import RawReactionActionEvent
|
||||
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.abc.auto_role_repository_abc import AutoRoleRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from modules.base.helper.base_reaction_handler import BaseReactionHandler
|
||||
@ -12,7 +13,7 @@ from modules.base.helper.base_reaction_handler import BaseReactionHandler
|
||||
class BaseOnRawReactionAddEvent(OnRawReactionAddABC):
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
servers: ServerRepositoryABC,
|
||||
auto_roles: AutoRoleRepositoryABC,
|
||||
|
@ -4,6 +4,7 @@ from cpl_discord.service import DiscordBotServiceABC
|
||||
from discord import RawReactionActionEvent
|
||||
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.abc.auto_role_repository_abc import AutoRoleRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from modules.base.helper.base_reaction_handler import BaseReactionHandler
|
||||
@ -12,7 +13,7 @@ from modules.base.helper.base_reaction_handler import BaseReactionHandler
|
||||
class BaseOnRawReactionRemoveEvent(OnRawReactionRemoveABC):
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
servers: ServerRepositoryABC,
|
||||
auto_roles: AutoRoleRepositoryABC,
|
||||
|
@ -5,6 +5,7 @@ from cpl_discord.service import DiscordBotServiceABC
|
||||
from discord import EventStatus
|
||||
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from modules.base.model.active_event import ActiveEvent
|
||||
from modules.base.service.event_service import EventService
|
||||
|
||||
@ -12,7 +13,7 @@ from modules.base.service.event_service import EventService
|
||||
class BaseOnScheduledEventUpdateEvent(OnScheduledEventUpdateABC):
|
||||
def __init__(
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
events: EventService,
|
||||
):
|
||||
|
@ -8,6 +8,7 @@ from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import OnVoiceStateUpdateABC
|
||||
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
|
||||
@ -25,7 +26,7 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
servers: ServerRepositoryABC,
|
||||
known_users: KnownUserRepositoryABC,
|
||||
users: UserRepositoryABC,
|
||||
|
@ -6,6 +6,7 @@ from cpl_translation import TranslatePipe
|
||||
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.model.server_config import ServerConfig
|
||||
from bot_core.abc.permission_service_abc import PermissionServiceABC
|
||||
@ -15,7 +16,7 @@ class BaseOnVoiceStateUpdateEventHelpChannel(OnVoiceStateUpdateABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
servers: ServerRepositoryABC,
|
||||
permissions: PermissionServiceABC,
|
||||
message_service: MessageServiceABC,
|
||||
|
@ -5,6 +5,7 @@ from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import OnVoiceStateUpdateABC
|
||||
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from modules.base.service.event_service import EventService
|
||||
@ -14,7 +15,7 @@ class BaseOnVoiceStateUpdateEventScheduledEventBonus(OnVoiceStateUpdateABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
servers: ServerRepositoryABC,
|
||||
users: UserRepositoryABC,
|
||||
events: EventService,
|
||||
|
@ -10,6 +10,7 @@ from discord import guild
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.model.server_config import ServerConfig
|
||||
from bot_data.model.technician_config import TechnicianConfig
|
||||
|
||||
@ -18,7 +19,7 @@ class BootLogOnReadyEvent(OnReadyABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
message_service: MessageServiceABC,
|
||||
translate: TranslatePipe,
|
||||
|
@ -1,8 +1,8 @@
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.events import OnReadyABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_core.service.config_service import ConfigService
|
||||
from bot_core.service.data_integrity_service import DataIntegrityService
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
@ -12,7 +12,7 @@ class ConfigOnReadyEvent(OnReadyABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
servers: ServerRepositoryABC,
|
||||
config_service: ConfigService,
|
||||
|
@ -5,13 +5,14 @@ from cpl_discord.events import OnMemberJoinABC
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_core.logging.message_logger import MessageLogger
|
||||
from bot_data.model.server_config import ServerConfig
|
||||
from modules.level.service.level_service import LevelService
|
||||
|
||||
|
||||
class LevelOnMemberJoinEvent(OnMemberJoinABC):
|
||||
def __init__(self, config: ConfigurationABC, logger: MessageLogger, level: LevelService):
|
||||
def __init__(self, config: ConfigurationABC, logger: EventLogger, level: LevelService):
|
||||
OnMemberJoinABC.__init__(self)
|
||||
self._config = config
|
||||
self._logger = logger
|
||||
|
@ -7,6 +7,7 @@ from discord import RawReactionActionEvent
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.model.server_config import ServerConfig
|
||||
from modules.level.service.level_service import LevelService
|
||||
|
||||
@ -15,7 +16,7 @@ class LevelOnRawReactionAddEvent(OnRawReactionAddABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
level: LevelService,
|
||||
):
|
||||
|
@ -7,6 +7,7 @@ from discord import RawReactionActionEvent
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.model.server_config import ServerConfig
|
||||
from modules.level.service.level_service import LevelService
|
||||
|
||||
@ -15,7 +16,7 @@ class LevelOnRawReactionRemoveEvent(OnRawReactionRemoveABC):
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
logger: EventLogger,
|
||||
bot: DiscordBotServiceABC,
|
||||
level: LevelService,
|
||||
):
|
||||
|
@ -6,12 +6,13 @@ from cpl_discord.events import OnVoiceStateUpdateABC
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.logging.event_logger import EventLogger
|
||||
from bot_data.model.server_config import ServerConfig
|
||||
from modules.level.service.level_service import LevelService
|
||||
|
||||
|
||||
class LevelOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
|
||||
def __init__(self, config: ConfigurationABC, logger: LoggerABC, level: LevelService):
|
||||
def __init__(self, config: ConfigurationABC, logger: EventLogger, level: LevelService):
|
||||
OnVoiceStateUpdateABC.__init__(self)
|
||||
self._config = config
|
||||
self._logger = logger
|
||||
|
Loading…
Reference in New Issue
Block a user