4 from flexbe_msgs.msg
import BehaviorLog
9 Realizes behavior-specific logging. 11 REPORT_INFO = BehaviorLog.INFO
12 REPORT_WARN = BehaviorLog.WARN
13 REPORT_HINT = BehaviorLog.HINT
14 REPORT_ERROR = BehaviorLog.ERROR
15 REPORT_DEBUG = BehaviorLog.DEBUG
17 LOGGING_TOPIC =
'flexbe/log' 23 Logger._pub = rospy.Publisher(Logger.LOGGING_TOPIC, BehaviorLog, queue_size=100)
26 def log(text, severity):
27 if Logger._pub
is None:
32 msg.status_code = severity
33 Logger._pub.publish(msg)
35 Logger.local(text, severity)
39 if severity == Logger.REPORT_INFO:
41 elif severity == Logger.REPORT_WARN:
43 elif severity == Logger.REPORT_HINT:
44 rospy.loginfo(
'\033[94mBehavior Hint: %s\033[0m', text)
45 elif severity == Logger.REPORT_ERROR:
47 elif severity == Logger.REPORT_DEBUG:
50 rospy.logdebug(text +
' (unknown log level %s)' % str(severity))
54 Logger.log(text % args, Logger.REPORT_DEBUG)
58 Logger.log(text % args, Logger.REPORT_INFO)
62 Logger.log(text % args, Logger.REPORT_WARN)
66 Logger.log(text % args, Logger.REPORT_HINT)
70 Logger.log(text % args, Logger.REPORT_ERROR)
74 Logger.local(text % args, Logger.REPORT_DEBUG)
78 Logger.local(text % args, Logger.REPORT_INFO)
def localdebug(text, args)
def local(text, severity)
def localinfo(text, args)