^%ZSTART
该例程包含 IRIS
实际调用的入口点。它使用刚刚描述的 ^%ZSSUtil
的服务。所有入口点的行为大致相同,它们在日志中放置一些信息。 SYSTEM
入口点比其他入口点稍微复杂一些。它还将信息放在操作员消息日志中。
%ZSTART ; User startup routine.#define ME "ZSTART"
#define BgnSet "Start"
#define Empty ""; cannot be invoked directlyquitSYSTEM ;; InterSystems IRIS startingnew EntryPoint, Itemsset EntryPoint = "SYSTEM"; record the fact we got started in the messages logdo WriteConsole^%ZSSUtil((EntryPoint_ "^%"_ $$$ME_ " called @ "_ $ZDATETIME($HOROLOG, 3))); log the data accumulate resultsset Items = $LISTBUILD($$$BgnSet, $ZDATETIME($HOROLOG, 3),"Job", $JOB,"Computer", ##class(%SYS.System).GetNodeName(),"Version", $ZVERSION,"StdIO", $PRINCIPAL,"Namespace", $NAMESPACE,"CurDirPath", ##class(%File).ManagerDirectory(),"CurNSPath", ##class(%File).NormalizeDirectory(""),"CurDevName", $System.Process.CurrentDevice(),"JobType", $System.Process.JobType(),"JobStatus", $ZHEX($ZJOB),"StackFrames", $STACK,"AvailStorage", $STORAGE,"UserName", $System.Process.UserName())do WriteLog^%ZSSUtil($$$ME, EntryPoint, Items)quit
LOGIN ;; a user logs into InterSystems IRISnew EntryPoint, Itemsset EntryPoint = "LOGIN"set Items = $LISTBUILD($$$BgnSet, $ZDATETIME($HOROLOG, 3))do WriteLog^%ZSSUtil($$$ME, EntryPoint, Items)quitJOB ;; JOB'd process beginsnew EntryPoint, Itemsset EntryPoint = "JOB"set Items = $LISTBUILD($$$BgnSet, $ZDATETIME($HOROLOG, 3))do WriteLog^%ZSSUtil($$$ME, EntryPoint, Items)quitCALLIN ;; a process enters via CALLIN interfacenew EntryPoint, Itemsset EntryPoint = "CALLIN"set Items = $LISTBUILD($$$BgnSet, $ZDATETIME($HOROLOG, 3))do WriteLog^%ZSSUtil($$$ME, EntryPoint, Items)quit
以下是每个标签的说明:
^%ZSTART
此例程以Quit
命令开始,因此如果将其作为例程调用,而不是在其入口点之一正确开始执行,则它是良性的。
此例程还为自己的名称、起始字符串和空字符串定义命名常量(作为宏)。
SYSTEM^%ZSTART
此子例程构造一个由调用例程名称、入口点以及调用日期和时间组成的字符串。然后它调用WriteConsole^%ZSSUtil
将其放入操作员消息日志中。
然后,它构造一个它希望显示的名称-值对的列表。它将其传递给WriteLog^%ZSSUtil以放置到本地日志文件中。然后它返回给它的调用者。
LOGIN^%ZSTART
, JOB^%ZSTART
, and CALLIN^%ZSTART
这些子例程不会在操作员消息日志中放置任何信息。相反,他们构建了一个简短的项目列表,足以识别它们被调用,然后使用 WriteLog^%ZSSUtil
来记录它。
该例程包含 IRIS
实际调用的入口点,它使用 ^%ZSSUtil
中的子例程。此示例类似于 ^%ZSTART
的示例。有关详细信息,请参阅上一节。
%ZSTOP ; User shutdown routine.#define ME "ZSTOP"
#define EndSet "End"
#define Empty ""; cannot be invoked directlyquitSYSTEM ; InterSystems IRIS stoppingnew EntryPointset EntryPoint = "SYSTEM"; record termination in the messages logdo WriteConsole^%ZSSUtil((EntryPoint_ "^%"_ $$$ME_ " called @ "_ $ZDATETIME($HOROLOG, 3))); write the standard log informationdo Logit(EntryPoint, $$$ME)quitLOGIN ; a user logs out of InterSystems IRISnew EntryPointset EntryPoint = "LOGIN"do Logit(EntryPoint, $$$ME)quitJOB ; JOB'd process exits.new EntryPointset EntryPoint = "JOB"do Logit(EntryPoint, $$$ME)quitCALLIN ; process exits via CALLIN interface.new EntryPointset EntryPoint = "CALLIN"do Logit(EntryPoint, $$$ME)quitLogit(entrypoint, caller) PRIVATE ;; common logging for exitsnew itemsset items = $LISTBUILD($$$EndSet, $ZDATETIME($HOROLOG, 3))do WriteLog^%ZSSUtil(caller, entrypoint, items)quit