Logging¶
GsshaPy uses the default Python logging module. By default, nothing is logged anywhere. Here is how to configure your instance.
Print to console¶
To use the default logging:
import gsshapy
gsshapy.log_to_console()
# then use gsshapy
To set custom level:
import gsshapy
gsshapy.log_to_console(level='INFO')
# then use gsshapy
-
gsshapy.
log_to_console
(status=True, level=None)[source]¶ Log events to the console.
Parameters: - status (bool, Optional, Default=True) – whether logging to console should be turned on(True) or off(False)
- level (string, Optional, Default=None) – level of logging; whichever level is chosen all higher levels will be logged. See: https://docs.python.org/2/library/logging.html#levels
Log to file¶
To use the default logging:
import gsshapy
gsshapy.log_to_file(filename='gsshapy_run.log')
# then use gsshapy
To set custom level:
import gsshapy
gsshapy.log_to_file(filename='gsshapy_run.log', level='INFO')
# then use gsshapy
-
gsshapy.
log_to_file
(status=True, filename='/home/docs/.cache/gsshapy/log/gsshapy.log', level=None)[source]¶ Log events to a file.
Parameters: - status (bool, Optional, Default=True) – whether logging to file should be turned on(True) or off(False)
- filename (string, Optional, Default=None) – path of file to log to
- level (string, Optional, Default=None) – level of logging; whichever level is chosen all higher levels will be logged. See: https://docs.python.org/2/library/logging.html#levels