msl.io.dataset_logging module
A Dataset that handles logging records.
- class msl.io.dataset_logging.DatasetLogging(name, parent, level=0, attributes=None, logger=None, date_fmt=None, **kwargs)[source]
-
A
Datasetthat handlesloggingrecords.Do not instantiate directly. Create a new
DatasetLoggingusingcreate_dataset_logging().- Parameters:
level (
intorstr, optional) – The logging level to use.attributes (
listortupleofstr, optional) – The attribute names to include in theDatasetfor each logging record.logger (
Logger, optional) – TheLoggerthat thisDatasetLoggingobject will be added to. IfNonethen it is added to therootLogger.date_fmt (
str, optional) – Thedatetimeformat code to use to represent theasctimeattribute in.**kwargs – Additional keyword arguments are passed to
Dataset. The default behaviour is to append every logging record to theDataset. This guarantees that the size of theDatasetis equal to the number of logging records that were added to it. However, this behaviour can decrease the performance if many logging records are added often because a copy of the data in theDatasetis created for each logging record that is added. You can improve the performance by specifying an initial size of theDatasetby including a shape or a size keyword argument. This will also automatically create additional empty rows in theDataset, that is proportional to the size of theDataset, if the size of theDatasetneeds to be increased. If you do this then you will want to callremove_empty_rows()before writingDatasetLoggingto a file or interacting with the data inDatasetLoggingto remove the extra rows that were created.
- property attributes
The attribute names used by the
DatasetLoggingobject.
- property date_fmt
The
datetimeformat code that is used to represent theasctimeattribute in.- Type:
- property logger
The
Loggerthat thisDatasetLoggingobject is added to.- Type:
- remove_empty_rows()[source]
Remove empty rows from the
Dataset.If the
DatasetLoggingobject was initialized with a shape or a size keyword argument then the size of theDatasetis always \(\geq\) to the number of logging records that were added to it. Calling this method will remove the rows in theDatasetthat were not from a logging record.