pyhrf.tools.message module¶
This package provide a mean to print colored message to a standard terminal if color is available else message are print in black and white mode. If stdout is redirected in a file or piped to an other program, the output is made black and white to avoid issus with strange caracters that defined colors in terminals. Remember that all messages are print to stdout.
- This package exists in 3 places, for some very good arguments :
- datamind.tools.message soma.wip.message pyhrf.tools.message
To use these functionalities, play with ‘msg’ instance. Here, some classical uses :
msg.info(‘something cool happend’): msg.error(self, ‘too bad, an error’): msg.warning(self, ‘something strange but not fatal’): msg.write_list((‘no color’, (‘color in red’, ‘red’))): msg.write(‘simple colored write function’) msg.string(‘string to colored string’)
-
class
pyhrf.tools.message.
MessageColor
¶ Bases:
object
-
classmethod
error
(msg)¶
-
haveColor
()¶
-
classmethod
info
(msg)¶
-
classmethod
string
(msg, color='back')¶
-
classmethod
warning
(msg)¶
-
classmethod
write
(msg, color='back')¶
-
classmethod
write_list
(msg_list)¶
-
classmethod