src.Libs package

Subpackages

Submodules

src.Libs.LogClass module

This file is part of the PAFFrontendSim.

The PAFFrontendSim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation.

The PAFFrontendSim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the PAFFrontendSim. If not, see https://www.gnu.org/licenses/.

class src.Libs.LogClass.LogClass(label='', logPath=None)[source]

Bases: object

Module to replace Pythons built-in print function with a more complex alternative.

Since the simulator consists of multiple modules, it is important to discern the origin of printed messages. For this reason, messages printed by LogClass are preceeded by a header. This header contains the name of the module producing the message as well as the object hierarchy. Optionally all messages can be stored in .log-files. There is a .log-file for each module as well as a global file with all messages. Additionally each message has a type of importance. The importance affects the color of the text (for example red for errors). It is also relevant for the verbosity. A low verbosity setting will only cause the most important messages to be printed.

addLabel(cls='')[source]

Add additional label to the label list.

Parameters:

cls (object) – Object of a class whose label should be added to the label

printOut(Message, message_type='user', noSpace=True, lineFeed=True)[source]

Class console output function.

Parameters :

Message (string): Message-text message_type (string): What type of message “Message” is. User, Error, etc. noSpace (boolean): print Class-name, otherwise only spces of the same length lineFeed (boolean): print line-feed at the end of the line

setScenario(Type='')[source]

Set predefined output scenarios.

Parameters:

Type (string) – id-string of the output scenario (so far defined, see constant-definitions above)

writelog(message, message_type)[source]

Write the message to the log files.

Parameters:
  • message (string) – The content of the message

  • message_type (string) – What kind of message it is, info, warning, error, etc.

Module contents