ユーザー定義のトレース用のトレース ハンドラー インターフェース
祖先 - なし
iTraceHandler インターフェイスは、オーバーヘッドの低いトレースメカニズムで、アプリケーションに組み込まれて、置き換えられるランタイムオブジェクトを用意することなく開発者にフィードバックを提供できます。 トレースステートメントは、 TraceMessageText と TraceMessageData メソッドを使用してRDMLXに書き込むことができ、そのまま残すことができます。実行時に Trace Handler が実装されていない限り、実質的に無視されます。
以下のサンプルは簡単な Web トレースハンドラです。 この再利用可能パーツがランタイムに作成され、クエリ文字列にパラメータとして Trace = True が追加されると、トレース出力がブラウザコンソールに送信されます。
Function Options(*DIRECT) Begin_Com Role(*EXTENDS #PRIM_OBJT *implements #Prim_App.iTraceHandler) * Include a Define_Com for this reusable part in your web page * It will install itself as the TraceHandler if "trace=true" is included as a parameter on the URL * You can then embed #sys_appln.TraceMessageText( aaa bbb ccc ddd ) whereever you want to send trace data to the console. * Each parameter equates to a single trace statement Evtroutine Handling(#Com_Owner.CreateInstance) For Each(#Parameter) In(#sys_web.UrlParameters) Continue If(#Parameter.Name.UpperCase <> Trace) Continue If(#Parameter.Value.uppercase <> True) #Sys_appln.TraceHandler <= #Com_owner /* Set this to be the trace handler for the application */ Leave Endfor Endroutine Mthroutine Name(TraceMessage) Help('Request to trace data received') Options(*redefine) #Com_owner.WriteToConsole( #ComponentName #Description #LineNumber #MessageText ) Endroutine Mthroutine Name(WriteToConsole) Help('Write an entry to the browser console') Access(*private) Define_Map For(*Input) Class(#prim_alph) Name(#ComponentName) Define_Map For(*Input) Class(#prim_alph) Name(#Description) Define_Map For(*Input) Class(#prim_nmbr) Name(#LineNumber) Define_Map For(*Input) Class(#prim_alph) Name(#Message) Define_Com Class(#prim_Dat) Name(#Now) #Message := #Now.now.AsLocalizedDateTime.AsString.Righttrim( "0" ) + " " + #ComponentName + " " + #Description + " " + #LineNumber.asstring + " " + #Message #sys_web.Console.Log( #Message ) Endroutine Mthroutine Name(TracingState) Options(*redefine) #MessageTracingActive := True Endroutine End_Com
名前 | 記述 |
---|---|
Initialize | ユーザー トレースが開始されると実行されます。 |
Terminate | ユーザー トレースが終了すると実行されます。 |
TraceMessage | トレース メッセージの発行時に常に実行されます。
ComponentName, Description, LineNumber, MessageText |
TracingState | トレースはアクティブか
MessageTracingActive |
2018 - V14SP1