Client SDK Version 1.8.0
Ionic Security client SDK for Python users
Classes | Functions | Variables
ionicsdk.log Namespace Reference

Classes

class  CustomLogger
 Logger Custom Class for capturing some portion (or all) logging in the Python code. More...
 
class  ISLog
 Defines the different ways to configure SDK logging. More...
 

Functions

def setup_simple (outputLogFile, append, severityLevel)
 Sets up SDK logging to write to the specified file path. More...
 
def setup_from_config_json (configJson, baseFileWriterPath=None)
 Sets up SDK logging using the specified JSON-formatted configuration string. More...
 
def setup_from_config_file (configFile, baseFileWriterPath=None)
 
def is_setup ()
 Determines if the Ionic logger has been set up. More...
 
def shutdown ()
 Shuts down the Ionic logger. More...
 
def log (severity, channelName, lineNumber, fileName, message)
 

Variables

int SEV_INVALID = -1
 Represents an invalid/unknown log severity level.
 
int SEV_TRACE = 0
 Represents TRACE level log severity.
 
int SEV_DEBUG = 1
 Represents DEBUG level log severity.
 
int SEV_INFO = 2
 Represents INFO level log severity.
 
int SEV_WARN = 3
 Represents WARN level log severity.
 
int SEV_ERROR = 4
 Represents ERROR level log severity.
 
int SEV_FATAL = 5
 Represents FATAL level log severity.
 
string PYTHON_LOG_CHANNEL = "ISPython"
 Name of the log channel for python-specific logging.
 

Detailed Description

Logger configuration.

Function Documentation

◆ is_setup()

def ionicsdk.log.is_setup ( )

Determines if the Ionic logger has been set up.

Returns
True if the Ionic logger is set up and ready to use. Otherwise, returns false.

◆ log()

def ionicsdk.log.log (   severity,
  channelName,
  lineNumber,
  fileName,
  message 
)

Writes the specified message to the Ionic logger.

Available severity levels:

  • SEV_INVALID -1
  • SEV_TRACE 0
  • SEV_DEBUG 1
  • SEV_INFO 2
  • SEV_WARN 3
  • SEV_ERROR 4
  • SEV_FATAL 5
Parameters
severity(int): Specifies how detailed the logging will be - SEV_TRACE and SEV_FATAL are the most detailed and the least detailed levels, respectively.
channelName(string): The channel name is an arbitrary string that may be used by the logger to perform custom/configurable message routing.
lineNumber(int): The line number in the source file associated with the log message.
fileName(string, optional): The source file name associated with the log message. This parameter is optional so the empty string "" is an acceptable input.
message(string): The log message string.
Returns
None

◆ setup_from_config_file()

def ionicsdk.log.setup_from_config_file (   configFile,
  baseFileWriterPath = None 
)

Sets up logging using the provided JSON formatted configuration file.

Example: ionicsdk.log.setup_from_config_file("config.json", "home/base/path")

See Log Configuration from JSON for full documentation on the supported JSON configuration format.

Parameters
configFile(string): The log configuration JSON-formatted file.
baseFileWriterPath(string, optional): If specified, this path will be prepended to any relative file paths found in the logger configuration. Otherwise, the base path defaults to the current working directory.
Returns
None

◆ setup_from_config_json()

def ionicsdk.log.setup_from_config_json (   configJson,
  baseFileWriterPath = None 
)

Sets up SDK logging using the specified JSON-formatted configuration string.

Example: ionicsdk.log.setup_from_config_json({ "sinks": [ { "channels": [ "*" ],

"filter": { "type": "Severity", "level": "INFO" },

"writers": [ { "type": "Console" },

{ "type": "RotatingFile", "filePattern": "ionic_ie_%Y-%m-%d_%H-%M-%S.log", "rotationSchedule": "DAILY", "rotationSize": "100mb" } ] },

{ "channels": [ "MyModuleName" ],

"filter": { "type": "Severity", "level": "TRACE" },

"writers": [ { "type": "File", "filePattern": "ionic_http_trace_%Y-%m-%d_%H-%M-%S.log" } ] } ] }, "/home/base/path")

See Log Configuration from JSON for full documentation on the supported JSON configuration format.

Parameters
configJson(string): The log configuration JSON-formatted string.
baseFileWriterPath(string, optional): If specified, this path will be prepended to any relative file paths found in the logger configuration. Otherwise, the base path defaults to the current working directory.
Returns
None

◆ setup_simple()

def ionicsdk.log.setup_simple (   outputLogFile,
  append,
  severityLevel 
)

Sets up SDK logging to write to the specified file path.

If the file does not exist, it will be created. To achieve more fine grained control over the logger, its output mechanism(s), etc. refer to setup_from_config_file() and setup_from_config_json().

Example:
ionicsdk.log.setup_simple("log.txt", False, ionicsdk.log.SEV_DEBUG)

Available severity levels:

  • SEV_INVALID -1
  • SEV_TRACE 0
  • SEV_DEBUG 1
  • SEV_INFO 2
  • SEV_WARN 3
  • SEV_ERROR 4
  • SEV_FATAL 5
Parameters
outputLogFile(string): The output file path to log to. If the file does not exist, it will be created.
append(bool): If set to true, the log file will be appended to if it already exists. Otherwise, the log file will be overwritten and any existing data at the specified path will effectively be erased.
severityLevel(int): Specifies how detailed the logging will be - SEV_TRACE and SEV_FATAL are the most detailed and the least detailed levels, respectively.
Returns
None

◆ shutdown()

def ionicsdk.log.shutdown ( )

Shuts down the Ionic logger.

If the logger is not already set up, then this function does nothing. Otherwise, it shuts down the logger and releases all associated resources (file handles, memory).

Returns
None