# Path: meowth/utils/snowflake.py
# MEOWTH_EPOCH = 1502123160
# def to_timestamp(_id):
# def create():
# 
# Path: meowth/core/cog_base.py
# class Cog(Cog):
#     """Base Class for Cogs to inherit in order to automate Cog setup.
# 
#     Defined ``__new__`` method ensures the Cog class is initialised
#     without explicitly calling ``super``. Works with multiple
#     inheritances.
# 
#     Base __init__ automatically assigns ``self.bot`` attribute, sets up the
#     logger while assigning it to ``self.logger`` attribute, and detects,
#     creates if necessary and assigns the cog packages database tables to
#     the ``self.tables`` attribute.
#     """
# 
#     _is_base = True
# 
#     def __new__(cls, bot, *args, **kwargs):
#         instance = super().__new__(cls, *args, **kwargs)
#         def run_cog_init(klass):
#             for base in klass.__bases__:
#                 if base is object:
#                     return
#                 elif base._is_base:
#                     base.__init__(instance, bot)
#                 else:
#                     run_cog_init(base)
#         run_cog_init(instance.__class__)
#         return instance
# 
#     def __init_subclass__(cls):
#         cls._is_base = False
# 
#     def __init__(self, bot):
#         self.bot = bot
#         self.tables = None
#         module = self.__class__.__module__
#         cog = self.__class__.__name__
#         log_name = f"{module}.{cog}"
#         self.logger = logging.getLogger(log_name)
#         self._check_tables_module()
# 
#     def _check_tables_module(self):
#         this_module = self.__class__.__module__
#         try:
#             tbl_mod = importlib.import_module('..tables', this_module)
#         except ModuleNotFoundError:
#             pass
#         else:
#             if not hasattr(tbl_mod, 'setup'):
#                 del tbl_mod
#             else:
#                 self.bot.loop.create_task(self._table_setup(tbl_mod))
# 
#     async def _table_setup(self, table_module):
#         cog_name = self.__class__.__name__
#         cog_tables = table_module.setup(self.bot)
#         if not isinstance(cog_tables, (list, tuple)):
#             cog_tables = [cog_tables]
#         self.tables = Map({t.name:t for t in cog_tables})
#         for table in self.tables.values():
#             if await table.exists():
#                 self.logger.info(
#                     f'Cog table {table.name} for {cog_name} found.')
#                 table.new_columns = []
#                 table.initial_data = []
#                 continue
#             await table.create()
#             self.logger.info(f'Cog table {table.name} for {cog_name} created.')
#         del table_module


import asyncio
import os
import sys
import json
import logging
import asyncpg
import discord
from datetime import timezone
from logging import handlers
from meowth.utils import snowflake
from .cog_base import Cog
        super().__init__(level=level)

    def emit(self, record):
        record_id = next(get_id)
        asyncio.run_coroutine_threadsafe(
            self.submit_log(record_id, record), self.bot.loop)

    async def submit_log(self, log_id, record):
        data = dict(log_id=log_id,
                    created=record.created,
                    logger_name=str(record.name),
                    level_name=str(record.levelname),
                    file_path=str(record.pathname),
                    module=str(record.module),
                    func_name=str(record.funcName),
                    line_no=record.lineno,
                    message=str(record.message),
                    traceback=str(record.exc_info))
        try:
            table = self.bot.dbi.table(self.log_name)
            table.insert(**data)
            await table.insert.commit()
        except asyncpg.PostgresError as e:
            self.logger.exception(type(e).__name__, exc_info=e)

class ActivityLogging(Cog):
    def __init__(self, bot):
        self.bot = bot
        self.logger = module_logger.getChild('ActivityLogging')


# Path: meowth/utils/snowflake.py
# MEOWTH_EPOCH = 1502123160
# def to_timestamp(_id):
# def create():
# 
# Path: meowth/core/cog_base.py
# class Cog(Cog):
#     """Base Class for Cogs to inherit in order to automate Cog setup.
# 
#     Defined ``__new__`` method ensures the Cog class is initialised
#     without explicitly calling ``super``. Works with multiple
#     inheritances.
# 
#     Base __init__ automatically assigns ``self.bot`` attribute, sets up the
#     logger while assigning it to ``self.logger`` attribute, and detects,
#     creates if necessary and assigns the cog packages database tables to
#     the ``self.tables`` attribute.
#     """
# 
#     _is_base = True
# 
#     def __new__(cls, bot, *args, **kwargs):
#         instance = super().__new__(cls, *args, **kwargs)
#         def run_cog_init(klass):
#             for base in klass.__bases__:
#                 if base is object:
#                     return
#                 elif base._is_base:
#                     base.__init__(instance, bot)
#                 else:
#                     run_cog_init(base)
#         run_cog_init(instance.__class__)
#         return instance
# 
#     def __init_subclass__(cls):
#         cls._is_base = False
# 
#     def __init__(self, bot):
#         self.bot = bot
#         self.tables = None
#         module = self.__class__.__module__
#         cog = self.__class__.__name__
#         log_name = f"{module}.{cog}"
#         self.logger = logging.getLogger(log_name)
#         self._check_tables_module()
# 
#     def _check_tables_module(self):
#         this_module = self.__class__.__module__
#         try:
#             tbl_mod = importlib.import_module('..tables', this_module)
#         except ModuleNotFoundError:
#             pass
#         else:
#             if not hasattr(tbl_mod, 'setup'):
#                 del tbl_mod
#             else:
#                 self.bot.loop.create_task(self._table_setup(tbl_mod))
# 
#     async def _table_setup(self, table_module):
#         cog_name = self.__class__.__name__
#         cog_tables = table_module.setup(self.bot)
#         if not isinstance(cog_tables, (list, tuple)):
#             cog_tables = [cog_tables]
#         self.tables = Map({t.name:t for t in cog_tables})
#         for table in self.tables.values():
#             if await table.exists():
#                 self.logger.info(
#                     f'Cog table {table.name} for {cog_name} found.')
#                 table.new_columns = []
#                 table.initial_data = []
#                 continue
#             await table.create()
#             self.logger.info(f'Cog table {table.name} for {cog_name} created.')
#         del table_module


# Path: meowth/core/logger.py
import asyncio
import os
import sys
import json
import logging
import asyncpg
import discord
from datetime import timezone
from logging import handlers
from meowth.utils import snowflake
from .cog_base import Cog

        super().__init__(level=level)

    def emit(self, record):
        record_id = next(get_id)
        asyncio.run_coroutine_threadsafe(
            self.submit_log(record_id, record), self.bot.loop)

    async def submit_log(self, log_id, record):
        data = dict(log_id=log_id,
                    created=record.created,
                    logger_name=str(record.name),
                    level_name=str(record.levelname),
                    file_path=str(record.pathname),
                    module=str(record.module),
                    func_name=str(record.funcName),
                    line_no=record.lineno,
                    message=str(record.message),
                    traceback=str(record.exc_info))
        try:
            table = self.bot.dbi.table(self.log_name)
            table.insert(**data)
            await table.insert.commit()
        except asyncpg.PostgresError as e:
            self.logger.exception(type(e).__name__, exc_info=e)

class ActivityLogging(Cog):
    def __init__(self, bot):
        self.bot = bot
        self.logger = module_logger.getChild('ActivityLogging')


    @Cog.listener()