1#############################################################################
2# Software Testing Automation Framework (STAF)                              #
3# (C) Copyright IBM Corp. 2001                                              #
4#                                                                           #
5# This software is licensed under the Eclipse Public License (EPL) V1.0.    #
6#############################################################################
7
8# STAFMonitorDoLog - This function simply provides a function wrapper around
9#                    the LOG request of the Monitor service
10
11def STAFMonitorDoLog(stafHandle, message, system = "local", service = "Monitor"):
12    return stafHandle.submit(system, service, "LOG MESSAGE :%d:%s" % \
13                             (len(message), message))
14
15# STAFMonitor - This class is a wrapper around the STAF monitor service.
16#               It currently only provides a means to monitor locally.
17
18class STAFMonitor:
19
20    def __init__(self, stafHandle, system = "local", service = "Monitor"):
21        self.handle  = stafHandle
22        self.system  = system
23        self.service = service
24
25    def log(self, message):
26        return STAFMonitorDoLog(self.handle, message, self.system, self.service)
27