log.rst 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. .. This is a autogemerated documentation from python docstrings. It was generated using DStrings2Doc.
  2. .. module:: log
  3. .. _log:
  4. Module log
  5. ==========
  6. This is a custom logfile creation module
  7. .. py:class:: LogLevels:
  8. Used Log Levels Container
  9. .. py:class:: MeasurementLogger(object)
  10. Logfile creator class
  11. It will automatically get the info needed to create a logfile entry from registered functions.
  12. .. py:method:: __init__(self, filename=None, level=LogLevels.INFO, oneline=False)
  13. Initialise the logfile creator
  14. :param filename: (str) filename of the logfile THIS IS IGNORED AS OF NOW
  15. :param level: (int) valid log level (see LogLevels)
  16. :param oneline: (bool) whether to format the logfile entries in multilines or one line
  17. .. py:method:: __now(self)
  18. Get the current time in %Y-%m-%d %H:%M:%S format
  19. :return: the time
  20. .. py:method:: _logging_formatter(self, info)
  21. Formatter for the logfile entries
  22. Override this to implement custom formatters
  23. .. py:method:: _log(self, board_id, stuff)
  24. Write entries to logfile
  25. This will also make shure the directory the logfile is located is available and if not creates it
  26. :param stuff: (str) the entrie to write
  27. .. py:method:: register_parameter(self, logstring, func, args)
  28. This function is used to register parameters for the logfile entries
  29. :param logstring: (str) the string to describe the value in the logfile
  30. :param func: (callable) the function used to get the value
  31. :param args: arguments to pass to func upon gathering of information
  32. .. py:method:: reset_parameters(self)
  33. Resets all parameters (unregisteres all parameters)
  34. .. py:method:: register_dumper(self, func)
  35. Register a dumper that is used to dump a log of data into the logfile
  36. :param func: (callable) Function that is used as dumper
  37. .. py:method:: dump(self, board_id)
  38. Perform a dump (see register_dumper)
  39. .. py:method:: do_log(self, c=None, additional=None, board_id=None, level=LogLevels.INFO)
  40. Perform a log. This creates a log entry in the logfile
  41. :param c: (str) if this is not None this is the only text written to the logfile (in addition to the current time)
  42. :param additional: (str) This text is written below the current time to customize log entries
  43. :param board_id: the id of the board to log for, if this is not given, all boards are logged
  44. .. py:method:: log(c=None, additional=None, dump=False, board_id=None, level=LogLevels.INFO)
  45. Execute logging if logger was registered
  46. :param (str) c: if this is given c is the only entry that is created (additional is ignored)
  47. :param (str) additional: the additional text that is written below the current time
  48. :param (bool) dump: if this is true, a dump of every log value is performed
  49. :param board_id: the board id to log for, if this is not given, all boards are logged
  50. .. py:class:: ConfigureLog(QtGui.QDialog)
  51. Class that is basically a QDialog to configure the logger
  52. .. py:method:: __init__(self, parent=None):
  53. .. py:method:: initial_ticks(self)
  54. Set the initial ticks.
  55. .. py:method:: all_changed(self)
  56. This is called when the "all" checkbox is checked. It de/activates the other checkboxes
  57. .. py:method:: do(self)
  58. Change the logger instance to the activated log entries