Nitish Posted March 7 Posted March 7 When I am writing code in Data Lab, I can print to the logs. But, once I package the widget, it doesn't write anything to the logs any more. Is there any way to write to any logs from an add on please?
Seeq Team John Posted March 7 Seeq Team Posted March 7 @Nitish, Great question! What kind of Add-on are you developing? Is it an Add-on Tool or a frontend Add-on that uses a Data Lab Function as a backend? If you are developing an Add-on uses a Data Lab Function as a backend then you can directly call the reserved `LOG` variable to write to the Data Lab logger. Lets look at a really simple example of a function in the cell of a Data Lab Functions notebook. def add_ten(number=0): # This function adds 10 to a number LOG.info("Starting the process") try: new_number = number + 10 return new_number except Exception as e # Lets log this failure LOG.error(f"Failed to add ten with error - {e}" Alternatively, you can use the `getLogger` method from the logging module to get the Data Lab Functions Logger: import os import logging my_log = logging.getLogger(os.environ['SEEQ_DATALAB_FUNCTIONS_LOGGER']) my_log.info("Hello World!") The logs for the Data Lab Function can be viewed from : `https://your.seeq.server/data-lab/<DATALAB_PROJECT_ID>/functions/logs` Check out https://support.seeq.com/kb/latest/cloud/reserved-variables#id-(R64)ReservedVariables-TheLOGObject for more information.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now