Created
August 15, 2020 15:22
-
-
Save seifip/36691abb669d7d8cd68c8a185dfa8ca0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from robot.libraries.BuiltIn import BuiltIn | |
from RPA.core.helpers import required_param | |
from Logger import log_to_bugsnag | |
class RobotLogListener: | |
ROBOT_LIBRARY_SCOPE = 'GLOBAL' | |
ROBOT_LISTENER_API_VERSION = 3 | |
def __init__(self): | |
self.ROBOT_LIBRARY_LISTENER = self | |
def _log_message(self, message): | |
severity_map = { | |
'FAIL': 'error', | |
#'WARN': 'warning', | |
#'INFO': 'info' | |
} | |
if(message.level in severity_map.keys()): | |
severity = severity_map[message.level] | |
current_order_id = BuiltIn().get_variable_value("${CURRENT_ORDER_ID}") | |
context = f"Order {current_order_id}" if current_order_id else "General" | |
log_to_bugsnag(message.message, severity, context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment