You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/08/08 01:36:22 UTC

[GitHub] [incubator-superset] DiggidyDave commented on a change in pull request #7997: Event logger config takes instance instead of class

DiggidyDave commented on a change in pull request #7997: Event logger config takes instance instead of class
URL: https://github.com/apache/incubator-superset/pull/7997#discussion_r311825194
 
 

 ##########
 File path: superset/utils/log.py
 ##########
 @@ -83,6 +86,43 @@ def stats_logger(self):
         return current_app.config.get("STATS_LOGGER")
 
 
+def get_event_logger_from_cfg_value(cfg_value: object) -> AbstractEventLogger:
+    """
+    This function implements the deprecation of assignment of class objects to EVENT_LOGGER
+    configuration, and validates type of configured loggers.
+
+    The motivation for this method is to gracefully deprecate the ability to configure
+    EVENT_LOGGER with a class type, in favor of preconfigured instances which may have
+    required construction-time injection of proprietary or locally-defined dependencies.
+
+    :param cfg_value: The configured EVENT_LOGGER value to be validated
+    :return: if cfg_value is a class type, will return a new instance created using a
+    default con
+    """
+    result: Any = cfg_value
+    if inspect.isclass(cfg_value):
+        logging.getLogger().warning(
 
 Review comment:
   I feel like this is probably a more "correct" approach, but I tried to use `warnings.warn(msg, DeprecationWarning)` and didn't see any message locally. I'm sure it can be configured, but I wanted to be sure that this would be seen.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org