Ignore:
Timestamp:
04/09/11 12:31:22 (13 years ago)
Author:
tim
Message:

added a SetLogMask? function to pyregfi as an interface to regfi_log_set_mask
made pyregfi-smoketest.py easier to use

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/pyregfi/__init__.py

    r226 r227  
    133133
    134134
     135## An enumeration of log message types
     136#
     137# @note This is a static class, there is no need to instantiate it.
     138#       Just access its attributes directly as LOG_TYPES.INFO, etc
     139class LOG_TYPES(object):
     140    ## Informational messages, useful in debugging
     141    INFO  =  0x01
     142    ## Non-critical problems in structure parsing or intepretation
     143    WARN  =  0x04
     144    ## Major failures
     145    ERROR =  0x10
     146
     147
    135148def _buffer2bytearray(char_pointer, length):
    136149    if length == 0 or char_pointer == None:
     
    180193        return ''
    181194    return msgs.decode('utf-8')
     195
     196
     197## Sets the types of log messages to record
     198#
     199# @param log_types A sequence of message types that regfi should generate.
     200#                  Message types can be found in the LOG_TYPES enumeration.
     201#
     202# @return True on success, False on failure.  Failures are rare, but could
     203#         indicate that global logging is not operating as expected.
     204#
     205# Example:
     206# @code
     207# SetLogMask((LOG_TYPES.ERROR, LOG_TYPES.WARN, LOG_TYPES.INFO))
     208# @endcode
     209#
     210# The message mask is a global (all hives, iterators), thread-specific value.
     211# For more information, see @ref regfi_log_set_mask.
     212#
     213def SetLogMask(log_types):
     214    mask = 0
     215    for m in log_types:
     216        mask |= m
     217    return regfi.regfi_log_set_mask(mask)
     218
    182219
    183220
Note: See TracChangeset for help on using the changeset viewer.