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
Dataset
that handleslogging
records.Do not instantiate directly. Create a new
DatasetLogging
usingcreate_dataset_logging()
.- Parameters:
level (
int
orstr
, optional) – The logging level to use.attributes (
list
ortuple
ofstr
, optional) – The attribute names to include in theDataset
for each logging record.logger (
Logger
, optional) – TheLogger
that thisDatasetLogging
object will be added to. IfNone
then it is added to theroot
Logger
.date_fmt (
str
, optional) – Thedatetime
format code to use to represent theasctime
attribute 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 theDataset
is 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 theDataset
is created for each logging record that is added. You can improve the performance by specifying an initial size of theDataset
by 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 theDataset
needs to be increased. If you do this then you will want to callremove_empty_rows()
before writingDatasetLogging
to a file or interacting with the data inDatasetLogging
to remove the extra rows that were created.
- property attributes
The attribute names used by the
DatasetLogging
object.
- property date_fmt
The
datetime
format code that is used to represent theasctime
attribute in.- Type:
- property logger
The
Logger
that thisDatasetLogging
object is added to.- Type:
- remove_empty_rows()[source]
Remove empty rows from the
Dataset
.If the
DatasetLogging
object was initialized with a shape or a size keyword argument then the size of theDataset
is always \(\geq\) to the number of logging records that were added to it. Calling this method will remove the rows in theDataset
that were not from a logging record.