Revision: 3667
Author: pekka.klarck
Date: Sun May 30 05:33:49 2010
Log: support special HTML level in Message to reduce duplication
http://code.google.com/p/robotframework/source/detail?r=3667
Modified:
/trunk/src/robot/libraries/BuiltIn.py
/trunk/src/robot/output/loggerhelper.py
=======================================
--- /trunk/src/robot/libraries/BuiltIn.py Sat May 29 03:35:45 2010
+++ /trunk/src/robot/libraries/BuiltIn.py Sun May 30 05:33:49 2010
@@ -1157,8 +1157,7 @@
the console and in the Test Execution Errors section in the
log file.
"""
- level, html = (level, False) if level.upper() != 'HTML' else
('INFO', True)
- LOGGER.log_message(Message(utils.unic(message), level, html))
+ LOGGER.log_message(Message(utils.unic(message), level))
def log_many(self, *messages):
"""Logs the given messages as separate entries with the INFO
level."""
=======================================
--- /trunk/src/robot/output/loggerhelper.py Fri May 28 15:51:37 2010
+++ /trunk/src/robot/output/loggerhelper.py Sun May 30 05:33:49 2010
@@ -66,11 +66,16 @@
def __init__(self, message, level, html=False):
self.timestamp = utils.get_timestamp(daysep='', daytimesep=' ',
timesep=':', millissep='.')
- self.level = level.upper()
- if self.level not in LEVELS:
- raise DataError("Invalid log level '%s'" % level)
+ self.level, self.html = self._get_level_and_html(level, html)
self.message = self._process_message(message)
- self.html = html
+
+ def _get_level_and_html(self, level, html):
+ level = level.upper()
+ if level == 'HTML':
+ return 'INFO', True
+ if level not in LEVELS:
+ raise DataError("Invalid log level '%s'" % level)
+ return level, html
def _process_message(self, msg):
if not isinstance(msg, basestring):