19.4.2 Setting of operational message output
This section explains how to use sysmsg module to print a specified character string as an operation message.
The following tables list the functions of sysmsg module.
Function Name |
Description |
---|---|
send |
Outputs operation messages. |
- <Structure of this section>
(1) Script file and execution results example
The following is an example of a script file that outputs operation messages.
# test1.py # -*- coding: utf-8 -*- import sys import extlib.sysmsg ..1 try: extlib.sysmsg.send("E3", 0xfedc, 0xba9876543210,"Script Start!!") ..2 print("send success.") except extlib.sysmsg.MsgSendError: ..3 print("send failed.") sys.exit() |
-
Import the module.
-
Specify the operation message to be output as follows:
-
Event-Level E3
-
Message-identifier 3e03fedc
-
Additional information ba9876543210
-
Message text "Script Start!!"
-
-
Captures an exception for failed operation message output.
The following shows the results of executing the script file test1.py and output of operation messages.
# python test1.py send success. # |
EVT 07/07 12:00:00 01S E3 SCRIPT 3e03fedc 2600:ba9876543210 Script Start!! |