Exemple #1
0
def openlog(ident=None, logoption=0, facility=lib.LOG_USER):
    global _S_ident_o, _S_log_open
    if ident is None:
        ident = _get_argv()
    if ident is None:
        _S_ident_o = ffi.NULL
    elif isinstance(ident, str):
        _S_ident_o = ffi.new("char[]", ident)  # keepalive
    else:
        raise TypeError("'ident' must be a string or None")
    lib.openlog(_S_ident_o, logoption, facility)
    _S_log_open = True
def openlog(ident=None, logoption=0, facility=lib.LOG_USER):
    global _S_ident_o, _S_log_open
    if ident is None:
        ident = _get_argv()
    if ident is None:
        _S_ident_o = ffi.NULL
    elif isinstance(ident, str):
        _S_ident_o = ffi.new("char[]", ident)    # keepalive
    else:
        raise TypeError("'ident' must be a string or None")
    lib.openlog(_S_ident_o, logoption, facility)
    _S_log_open = True
def openlog(ident=None, logoption=0, facility=lib.LOG_USER):
    global _S_ident_o, _S_log_open
    if ident is None:
        ident = _get_argv()
    if ident is None:
        _S_ident_o = ffi.NULL
    else:
        if not isinstance(ident, str):
            msg = "openlog() argument 1 must be a str, not {!r}"
            raise TypeError(msg.format(type(ident).__name__))
        ident = ident.encode(sys.getdefaultencoding())
        _S_ident_o = ffi.new("char[]", ident)  # keepalive
    lib.openlog(_S_ident_o, logoption, facility)
    _S_log_open = True
Exemple #4
0
def openlog(ident=None, logoption=0, facility=lib.LOG_USER):
    global _S_ident_o, _S_log_open
    if ident is None:
        ident = _get_argv()
    if ident is None:
        _S_ident_o = ffi.NULL
    else:
        if not isinstance(ident, str):
            msg = "openlog() argument 1 must be a str, not {!r}"
            raise TypeError(msg.format(type(ident).__name__))
        ident = ident.encode(sys.getdefaultencoding())
        _S_ident_o = ffi.new("char[]", ident)  # keepalive
    lib.openlog(_S_ident_o, logoption, facility)
    _S_log_open = True