Logging decorators

LogIt

class PyTango.LogIt(show_args=False, show_kwargs=False, show_ret=False)

A class designed to be a decorator of any method of a PyTango.DeviceImpl subclass. The idea is to log the entrance and exit of any decorated method.

Example:

class MyDevice(PyTango.Device_4Impl):
    
    @PyTango.LogIt()
    def read_Current(self, attr):
        attr.set_value(self._current, 1)

All log messages generated by this class have DEBUG level. If you whish to have different log level messages, you should implement subclasses that log to those levels. See, for example, PyTango.InfoIt.

The constructor receives three optional arguments:
  • show_args - shows method arguments in log message (defaults to False)
  • show_kwargs - shows keyword method arguments in log message (defaults to False)
  • show_ret - shows return value in log message (defaults to False)

DebugIt

class PyTango.DebugIt(show_args=False, show_kwargs=False, show_ret=False)

A class designed to be a decorator of any method of a PyTango.DeviceImpl subclass. The idea is to log the entrance and exit of any decorated method as DEBUG level records.

Example:

class MyDevice(PyTango.Device_4Impl):
    
    @PyTango.DebugIt()
    def read_Current(self, attr):
        attr.set_value(self._current, 1)

All log messages generated by this class have DEBUG level.

The constructor receives three optional arguments:
  • show_args - shows method arguments in log message (defaults to False)
  • show_kwargs - shows keyword method arguments in log message (defaults to False)
  • show_ret - shows return value in log message (defaults to False)

InfoIt

class PyTango.InfoIt(show_args=False, show_kwargs=False, show_ret=False)

A class designed to be a decorator of any method of a PyTango.DeviceImpl subclass. The idea is to log the entrance and exit of any decorated method as INFO level records.

Example:

class MyDevice(PyTango.Device_4Impl):
    
    @PyTango.InfoIt()
    def read_Current(self, attr):
        attr.set_value(self._current, 1)

All log messages generated by this class have INFO level.

The constructor receives three optional arguments:
  • show_args - shows method arguments in log message (defaults to False)
  • show_kwargs - shows keyword method arguments in log message (defaults to False)
  • show_ret - shows return value in log message (defaults to False)

WarnIt

class PyTango.WarnIt(show_args=False, show_kwargs=False, show_ret=False)

A class designed to be a decorator of any method of a PyTango.DeviceImpl subclass. The idea is to log the entrance and exit of any decorated method as WARN level records.

Example:

class MyDevice(PyTango.Device_4Impl):
    
    @PyTango.WarnIt()
    def read_Current(self, attr):
        attr.set_value(self._current, 1)

All log messages generated by this class have WARN level.

The constructor receives three optional arguments:
  • show_args - shows method arguments in log message (defaults to False)
  • show_kwargs - shows keyword method arguments in log message (defaults to False)
  • show_ret - shows return value in log message (defaults to False)

ErrorIt

class PyTango.ErrorIt(show_args=False, show_kwargs=False, show_ret=False)

A class designed to be a decorator of any method of a PyTango.DeviceImpl subclass. The idea is to log the entrance and exit of any decorated method as ERROR level records.

Example:

class MyDevice(PyTango.Device_4Impl):
    
    @PyTango.ErrorIt()
    def read_Current(self, attr):
        attr.set_value(self._current, 1)

All log messages generated by this class have ERROR level.

The constructor receives three optional arguments:
  • show_args - shows method arguments in log message (defaults to False)
  • show_kwargs - shows keyword method arguments in log message (defaults to False)
  • show_ret - shows return value in log message (defaults to False)

FatalIt

class PyTango.FatalIt(show_args=False, show_kwargs=False, show_ret=False)

A class designed to be a decorator of any method of a PyTango.DeviceImpl subclass. The idea is to log the entrance and exit of any decorated method as FATAL level records.

Example:

class MyDevice(PyTango.Device_4Impl):
    
    @PyTango.FatalIt()
    def read_Current(self, attr):
        attr.set_value(self._current, 1)

All log messages generated by this class have FATAL level.

The constructor receives three optional arguments:
  • show_args - shows method arguments in log message (defaults to False)
  • show_kwargs - shows keyword method arguments in log message (defaults to False)
  • show_ret - shows return value in log message (defaults to False)