Exemple #1
0
#!/usr/bin/env python3

print("start test")

import g3logPython
import sys
print("g3logPython imported")

logger = g3logPython.get_ifaceLogWorker(False)
try:
    journaldSink_1 = logger.SysLogSinks.new_Sink("journald_1", "id=g3log_1")
    journaldSink_2 = logger.SysLogSinks.new_Sink("journald_2", "id=g3log_2")

    print("loggers created")
    print("ERROR: this should have failed!")
    sys.exit(1)  # if no exception raised -> error

except Exception as inst:
    print(type(inst))
    print(inst.args)
    print(inst)
    print("error triggered as expected")
    sys.exit(0)
Exemple #2
0
def mute_stderr():
    logger = log.get_ifaceLogWorker()  # get access to the singleton
    hndl = logger.SysLogSinks.new_SinkHndl(
        "my journald")  # get a temporary handle from the sink's name
    future = hndl.muteStderr()
    future.join()  # optional
Exemple #3
0
#!/usr/bin/env python3

print("start test")

import g3logPython as log
print("g3logPython imported")

logger = log.get_ifaceLogWorker(False)
journaldSink = logger.SysLogSinks.new_Sink("journald",
                                           "g3logPython_TEST_journald")

print("loggers created")

journaldSink.echoToStderr()

journaldSink.setLogHeader(
    "========== g3logPython TEST journald + journalctl ==========")

print("logger configured")

debug_string = "debug: hello world! from python"
info_string = "some info from python"
warning_string = "important warning from python"

log.debug(debug_string)
log.info(info_string)
log.warning(warning_string)

print("echek journalctl -n50")
Exemple #4
0
def basic_log_init():
    logger = log.get_ifaceLogWorker(False)
    logger.SysLogSinks.new_Sink("my journald", "g3logPython_Example")