Skip to content

Commit

Permalink
mv event_logger_manager
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed May 8, 2024
1 parent cac2d88 commit fdbf7f4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion superset/extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from superset.async_events.async_query_manager import AsyncQueryManager
from superset.async_events.async_query_manager_factory import AsyncQueryManagerFactory
from superset.extensions.event_logger import EventLoggerManager
from superset.extensions.event_logger_manager import EventLoggerManager
from superset.extensions.ssh import SSHManagerFactory
from superset.extensions.stats_logger import BaseStatsLoggerManager
from superset.utils.cache_manager import CacheManager
Expand Down
39 changes: 39 additions & 0 deletions superset/extensions/event_logger_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

from superset.utils.log import AbstractEventLogger, StdOutEventLogger


class EventLoggerManager:
_instance = None

def __new__(cls) -> "EventLoggerManager":
if cls._instance is None:
cls._instance = super().__new__(cls)
cls._instance._event_logger = (
StdOutEventLogger()
) # Initialize with default logger
return cls._instance

def get_event_logger(self) -> AbstractEventLogger:
return self._event_logger

def set_event_logger(self, logger: AbstractEventLogger) -> None:
self._event_logger = logger # pylint: disable=attribute-defined-outside-init


__all__ = ["EventLoggerManager"]

0 comments on commit fdbf7f4

Please sign in to comment.