Logging decorators

LogIt

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

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

Example:

class MyDevice(tango.Device_4Impl):

    @tango.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, tango.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 tango.DebugIt(show_args=False, show_kwargs=False, show_ret=False)

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

Example:

class MyDevice(tango.Device_4Impl):

    @tango.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 tango.InfoIt(show_args=False, show_kwargs=False, show_ret=False)

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

Example:

class MyDevice(tango.Device_4Impl):

    @tango.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 tango.WarnIt(show_args=False, show_kwargs=False, show_ret=False)

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

Example:

class MyDevice(tango.Device_4Impl):

    @tango.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 tango.ErrorIt(show_args=False, show_kwargs=False, show_ret=False)

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

Example:

class MyDevice(tango.Device_4Impl):

    @tango.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 tango.FatalIt(show_args=False, show_kwargs=False, show_ret=False)

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

Example:

class MyDevice(tango.Device_4Impl):

    @tango.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)