Module sampy :: Class SAMPLog
[frames] | no frames]

Class SAMPLog

object --+
         |
        SAMPLog

SAMP Hub logging class. It provides methods for gracefully print SAMPy logging messages.

Instance Methods
 
__init__(self, level=3, stdout=sys.stderr, stderr=sys.stderr, prefix='SAMP')
Log class constructor.
 
setLevel(self, level)
Set the logging level.
int
getLevel(self)
Return the current logging level.
int/str
translateLevel(self, level)
Translate a logging level from the numeric form to a string form and vice versa.
 
info(self, message)
Log an INFO message.
 
error(self, message)
Log an ERROR message.
 
warning(self, message)
Log a WARNING message.
 
debug(self, message)
Log a DEBUG message.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  OFF = 0
  ERROR = 1
  WARNING = 2
  INFO = 3
  DEBUG = 4
Properties

Inherited from object: __class__

Method Details

__init__(self, level=3, stdout=sys.stderr, stderr=sys.stderr, prefix='SAMP')
(Constructor)

 

Log class constructor.

Parameters:
  • level (int) - logging level (one among OFF, ERROR, WARNING, INFO and DEBUG). By default it is set to INFO.
  • stdout (file) - file-like output device. By default it is set to sys.stdout.
  • stderr (file) - file-like error device. By default it is set to sys.stderr.
  • prefix (string) - prefix string to logging messages ("SAMP" by default)
Overrides: object.__init__

setLevel(self, level)

 

Set the logging level.

Parameters:

getLevel(self)

 

Return the current logging level.

Returns: int
the current logging level. See setLevel.

translateLevel(self, level)

 

Translate a logging level from the numeric form to a string form and vice versa. For example: ERROR is translated in "ERROR" string and vice versa.

Parameters:
  • level (int/str) - the logging level to be translated
Returns: int/str
the logging level traslated from the numeric form to the string form and vice versa.

info(self, message)

 

Log an INFO message.

Parameters:
  • message (string) - the message to be logged

error(self, message)

 

Log an ERROR message.

Parameters:
  • message (string) - the message to be logged

warning(self, message)

 

Log a WARNING message.

Parameters:
  • message (string) - the message to be logged

debug(self, message)

 

Log a DEBUG message.

Parameters:
  • message (string) - the message to be logged