コード例 #1
0
 def setUp(self):
     self._warnfile = _MockWarnFile()
     patterns_path = os.path.join(os.path.dirname(__file__),
                                  'console_patterns')
     self._alert_hooks = monitors_util.build_alert_hooks_from_path(
         patterns_path, self._warnfile)
     self._logfile = cStringIO.StringIO()
コード例 #2
0
 def setUp(self):
     self._warnfile = _MockWarnFile()
     patterns_path = os.path.join(os.path.dirname(__file__),
                                  'console_patterns')
     self._alert_hooks = monitors_util.build_alert_hooks_from_path(
             patterns_path, self._warnfile)
     self._logfile = cStringIO.StringIO()
コード例 #3
0
ファイル: console.py プロジェクト: yumingfei/autotest
def main():
    (options, args) = parser.parse_args()
    if len(args) != 2:
        parser.print_help()
        sys.exit(1)

    logfile = _open_logfile(args[0])
    warnfile = os.fdopen(int(args[1]), 'w', 0)
    # For now we aggregate all the alert_hooks.
    alert_hooks = []
    for patterns_path in options.pattern_paths.split(','):
        alert_hooks.extend(
            monitors_util.build_alert_hooks_from_path(patterns_path, warnfile))

    _set_logfile_close_signal_handler(logfile)
    try:
        monitors_util.process_input(sys.stdin, logfile,
                                    options.log_timestamp_format, alert_hooks)
    finally:
        logfile.close()
        _unset_signal_handler()
コード例 #4
0
ファイル: console.py プロジェクト: Antique/autotest
def main():
    (options, args) = parser.parse_args()
    if len(args) != 2:
        parser.print_help()
        sys.exit(1)

    logfile = _open_logfile(args[0])
    warnfile = os.fdopen(int(args[1]), 'w', 0)
    # For now we aggregate all the alert_hooks.
    alert_hooks = []
    for patterns_path in options.pattern_paths.split(','):
        alert_hooks.extend(monitors_util.build_alert_hooks_from_path(
            patterns_path, warnfile))

    _set_logfile_close_signal_handler(logfile)
    try:
        monitors_util.process_input(
            sys.stdin, logfile, options.log_timestamp_format, alert_hooks)
    finally:
        logfile.close()
        _unset_signal_handler()