winIDEA SDK
Loading...
Searching...
No Matches
test_logger.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
#
# (c) TASKING Germany GmbH, 2023
import os
import isystem.connect as ic
winidea_id = ''
def test_logger():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
print(f"Current logger ID: {connMgr.getId()}")
print("Initialize new logger...")
connMgr.initLogger("test_logger", "test_logger_out.py", ic.CLogger.PYTHON)
logger = connMgr.getLogger()
# a few examples of how logger can be used:
logger.setIndent(2)
logger.createVar("someInt", "int")
logger.log("someInt = 42")
logger.log("main()")
logger.logc("my visible comment")
logger.loggingOff()
logger.logc("will not be visible")
logger.loggingOn()
logger.closeLog("# end comment")
filePath = "test_logger_out.py"
print(f"Content of the created log file: {filePath}")
with open(filePath, "r") as fHandler:
print("'''")
print(fHandler.read())
print("'''")
if __name__ == "__main__":
test_logger()