MHVUL3 ;WAS/GPM - MHV UTILITIES - LOGGING ; 3/17/06 12:03am [5/24/06 10:18am]
;;1.0;My HealtheVet;**1**;Aug 23, 2005
;;Per VHA Directive 2004-038, this routine should not be modified.
;
Q
; Utilities supporting user options for logging
;
LOGONO ; Turn on logging
N RESULT,DIR,DIRUT,DA,X,Y,DTM,%DT
D LOGINFOO
W !
D LOGINFO^MHVUL1(.RESULT)
I RESULT("DELETE")="" S RESULT("DELETE")=$$HTFM^XLFDT($H+30,1)
;
; If logging is already on prompt if want to change deletion date
I RESULT("STATE") D Q:$D(DIRUT)!'Y
. S DIR(0)="Y"
. S DIR("A",1)="Logging is already turned on."
. S DIR("A")="Reset deletion date"
. S DIR("?",1)="MHV application logging is already active."
. S DIR("?")="You may enter a new deletion date for the log."
. S DIR("B")="NO"
. D ^DIR
. Q
;
; Prompt for deletion date
K DIR,DIRUT,DA,X,Y
S DIR(0)="DA^"_DT_"::TX"
S DIR("A")="Log Deletion Date: "
S DIR("?",1)="Enter a future date to delete MHV application log."
S DIR("?",2)="After this date logging will automatically be stopped,"
S DIR("?")="and all log entries permanently deleted."
S DIR("B")=$$FMTE^XLFDT(RESULT("DELETE"),1)
D ^DIR Q:$D(DIRUT)
;
D LOGON^MHVUL1(.RESULT,Y)
W !!,"MHV application logging switched on."
W !,"Log will be deleted on "_$$FMTE^XLFDT($P(RESULT,"^",2),1)_"."
Q
;
LOGSETO ; Set logging parameters
N RESULT,UPDATE,DIR,DIRUT,DA,X,Y,DTM,%DT,N,I
D LOGINFOO
W !
D LOGINFO^MHVUL1(.UPDATE)
;
; State ON/OFF
K DIR,DIRUT,DA,X,Y
S DIR(0)="SA^1:ON;0:OFF"
S DIR("A")="Logging: "
S DIR("?")="Enter ON or OFF"
S DIR("B")=$S(UPDATE("STATE"):"ON",1:"OFF")
D ^DIR
Q:$D(DIRUT)
S UPDATE("STATE")=Y
;
; Deletion Date
K DIR,DIRUT,DA,X,Y
S DIR(0)="DA^"_DT_"::TX"
S DIR("A")="Log Deletion Date: "
S DIR("?",1)="Enter a future date to delete MHV application log."
S DIR("?",2)="After this date logging will automatically be stopped,"
S DIR("?")="and all log entries permanently deleted."
S DIR("B")=$$FMTE^XLFDT(UPDATE("DELETE"))
D ^DIR Q:$D(DIRUT)
S UPDATE("DELETE")=Y
;
; Logging Level
K DIR,DIRUT,DA,X,Y
S DIR(0)="SA^E:ERROR;T:TRACE;N:NAMED;D:DEBUG"
S DIR("A")="Logging Level? "
S DIR("?",1)="Set logging level"
S DIR("?",2)="ERROR - only errors logged"
S DIR("?",3)="TRACE - Trace and errors logged"
S DIR("?",4)="NAMED - Named entries, trace and errors logged"
S DIR("?")="DEBUG - All entries logged"
S DIR("B")=UPDATE("LEVEL")
D ^DIR
Q:$D(DIRUT)
S UPDATE("LEVEL")=Y(0)
;
; Names
I UPDATE("LEVEL")="NAMED" D
. S N=UPDATE("NAMES")
. F I=2:1:$L(N,"^") S:$P(N,"^",I)'="" UPDATE("NAMES",$P(N,"^",I))=""
. F D Q:$D(DIRUT)
.. K DIR,DIRUT,DA,X,Y
.. S DIR(0)="FO^"
.. S DIR("A")="Entry name"
.. S DIR("A",1)=UPDATE("NAMES")
.. S DIR("?",1)="Enter names of entries to log"
.. S DIR("?")="Remove entries by prefixing with @"
.. S DIR("B")=""
.. D ^DIR
.. Q:$D(DIRUT)
.. I $E(Y)="@" K UPDATE("NAMES",$E(Y,2,$L(Y)))
.. E S UPDATE("NAMES",Y)=""
.. S UPDATE("NAMES")="^",N=""
.. F S N=$O(UPDATE("NAMES",N)) Q:N="" S UPDATE("NAMES")=UPDATE("NAMES")_N_"^"
.. Q
. Q
;
; Auto Purge ON/OFF
K DIR,DIRUT,DA,X,Y
S DIR(0)="SA^1:ON;0:OFF"
S DIR("A")="Auto Purge: "
S DIR("?")="Enter ON or OFF"
S DIR("B")=$S(UPDATE("AUTOPURGE"):"ON",1:"OFF")
D ^DIR
Q:$D(DIRUT)
S UPDATE("AUTOPURGE")=Y
;
; Days to Keep
I UPDATE("AUTOPURGE") D Q:$D(DIRUT)
. I 'UPDATE("DAYS") S UPDATE("DAYS")=7
. K DIR,DIRUT,DA,X,Y
. S DIR(0)="N^1:365"
. S DIR("A")="Days to Keep"
. S DIR("?")="Enter number of days to keep log entries"
. S DIR("B")=UPDATE("DAYS")
. D ^DIR
. S UPDATE("DAYS")=Y
. Q
;
W !!,"New MHV Application Log Settings:"
D LOGINFOD(.UPDATE)
W !
S DIR(0)="Y"
S DIR("A")="Ok to proceed with update"
S DIR("?")="Update logging parameters with those shown?"
S DIR("B")="NO"
D ^DIR Q:$D(DIRUT)
I 'Y Q
;
D LOGSET^MHVUL1(.RESULT,.UPDATE)
W !!,"Logging parameters updated"
D LOGINFOO
Q
;
LOGOFFO ;Turn off logging
N RESULT,DIR,DIRUT,DA,X,Y
D LOGINFOO
W !
D LOGINFO^MHVUL1(.RESULT)
; Quit if logging is already off
I 'RESULT("STATE") W !,"Logging is already turned off." Q
S DIR(0)="Y"
S DIR("A")="Turn off logging"
S DIR("?")="Turn off MHV application logging."
S DIR("B")="NO"
D ^DIR Q:$D(DIRUT)
I 'Y Q
;
D LOGOFF^MHVUL1(.RESULT)
W !!,"MHV application logging switched off."
W !,"Log will be deleted on "_$$FMTE^XLFDT($P(RESULT,"^",2),1)_"."
Q
;
LOGPRGO ; Purge log
N RESULT,DIR,DIRUT,DA,X,Y,DTM,%DT
D LOGINFOO
W !
; Purge from date
S DIR(0)="D^:"_DT_":TX"
S DIR("A")="Purge From Date"
S DIR("?",1)="Enter a past date to purge MHV application log."
S DIR("?")="All log entries older than this date will be removed."
S DIR("B")=$$HTE^XLFDT($H-7,1)
D ^DIR Q:$D(DIRUT)
S DTM=Y
;
; Confirm Purge
K DIR,DIRUT,DA,X,Y
S DIR(0)="Y"
S DIR("A",1)="Log will be purged from "_$$FMTE^XLFDT(DTM)_"."
S DIR("A")="OK to proceed"
S DIR("?")="All log entries older than this date will be removed."
S DIR("B")="NO"
D ^DIR Q:$D(DIRUT)
Q:'Y
;
D LOGPRG^MHVUL1(.RESULT,DTM)
W !!,"Log purged from "_$$FMTE^XLFDT($P(RESULT,"^",2),1)_"."
Q
;
LOGINFOO ; Display log information
N RESULT
D LOGINFO^MHVUL1(.RESULT)
W !!,"MHV Application Log Settings:"
D LOGINFOD(.RESULT)
Q
;
LOGINFOD(RESULT) ; Display log
W !," Log Creation Date: ",$$FMTE^XLFDT(RESULT("CREATED"))
W !," Log Deletion Date: ",$$FMTE^XLFDT(RESULT("DELETE"))
W !," Oldest Entry: ",$$FMTE^XLFDT(RESULT("OLDEST"))
W !," Newest Entry: ",$$FMTE^XLFDT(RESULT("NEWEST"))
W !," Logging: ",$S(RESULT("STATE"):"",1:"OFF")
I RESULT("STATE") D
. W RESULT("LEVEL")_" mode"
. I RESULT("LEVEL")="NAMED" W !,?16,"Names: ",RESULT("NAMES")
. Q
W !," Auto Purge: ",$S(RESULT("AUTOPURGE"):"",1:"OFF")
I RESULT("AUTOPURGE") W +RESULT("DAYS")," days"
Q
;
LOGSIZEO ; Display log size information
N RESULT
D LOGSIZE^MHVUL1(.RESULT)
W !!,"MHV Application Log Size:"
D LOGSIZED(.RESULT)
Q
;
LOGSIZED(RESULT) ; Display log size
W !," Number of Entries: ",RESULT("ENTRY COUNT")
W !," Number of Nodes: ",RESULT("NODE COUNT")
W !," Approx. size in KB: ",RESULT("BYTE COUNT")\1024
Q
;
LOGVIEWO ; View log
N LOG,CNT,DTM,J,ENTRY,RESULT,DIR,DIRUT,DTOUT,DUOUT,DA,X,Y,DTM
; Use the browser if supported by emulation
I $$TEST^DDBRT D LOGBROWS^MHVUL2 Q
K ^TMP("MHV LOG SUMMARY",$J)
K ^TMP("MHV LOG DETAIL",$J)
D LOGSUM^MHVUL1(.LOG)
S CNT=$P(@LOG,"^",2)
I CNT<1 D LOGSUMD(LOG) Q
F D Q:$D(DIRUT)
. D LOGSUMD(LOG) Q:$D(DTOUT)!$D(DUOUT)
. K DIR,X,DIRUT
. I 'Y D Q:$D(DIRUT)
.. S DIR(0)="N^1:"_CNT
.. S DIR("A")="Select Entry"
.. S DIR("?")="Select an entry to display"
.. D ^DIR
.. Q
. ;
. S DTM=$P(@LOG@(Y),"^")
. S J=$P(@LOG@(Y),"^",2)
. D LOGDET^MHVUL1(.ENTRY,DTM,J)
. D LOGDETD(ENTRY)
. K @ENTRY
. Q
K ^TMP("MHV LOG SUMMARY",$J)
K ^TMP("MHV LOG DETAIL",$J)
Q
;
LOGSUMD(LOG) ; Display log summary
N CNT,DTM,J,N
W !!,"LOG SUMMARY"
W !,?5,"Entry",?12,"Timestamp",?37,"Job",?50,"Items"
S CNT=$P(@LOG,"^",2)
I CNT<1 W !!,?12,"EMPTY" Q
S Y=0
K DIRUT,DTOUT,DUOUT
F I=1:1:CNT D Q:Y!$D(DTOUT)!$D(DUOUT)
. I I#22=0 D Q:Y!$D(DTOUT)!$D(DUOUT)
.. K DIR,X,Y,DIRUT,DTOUT,DUOUT
.. S DIR(0)="NO^1:"_CNT
.. S DIR("A",1)="Press <RETURN> to see more, '^' to exit, OR"
.. S DIR("A")="Select Entry"
.. S DIR("?")="Select an entry to display"
.. D ^DIR
.. Q
. S DTM=$$FMTE^XLFDT(-$P(@LOG@(I),"^"))
. S J=$P(@LOG@(I),"^",2)
. S N=$P(@LOG@(I),"^",3)
. W !,?5,I,?12,DTM,?37,J,?50,N
. Q
Q
;
LOGDETD(ENTRY) ;Display log entry
N CNT,DTM,J,N
W !!,"LOG DETAIL"
S CNT=$P(@ENTRY,"^",2)
I CNT<1 W !,?12,"EMPTY" Q
W !,?12,"Timestamp",?37,"Job",?50,"Items",?60,"Nodes"
S DTM=$$FMTE^XLFDT(-$P(@ENTRY@(0),"^"))
S J=$P(@ENTRY@(0),"^",2)
S N=$P(@ENTRY@(0),"^",3)
W !,?12,DTM,?37,J,?50,N,?60,CNT
S J=3
F I=1:1:CNT D Q:$D(DIRUT)
. S J=($L(@ENTRY@(I))+5)\80+1+J
. I J>23 D Q:$D(DIRUT)
.. K DIR,X,Y,DIRUT
.. S DIR(0)="E"
.. D ^DIR
.. S J=($L(@ENTRY@(I))+5)\80+1
.. Q
. W !,?5,@ENTRY@(I)
. Q
;
Q:$D(DIRUT)
K DIR,X,Y,DIRUT
S DIR(0)="E"
D ^DIR
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMHVUL3 8290 printed Dec 13, 2024@02:16:11 Page 2
MHVUL3 ;WAS/GPM - MHV UTILITIES - LOGGING ; 3/17/06 12:03am [5/24/06 10:18am]
+1 ;;1.0;My HealtheVet;**1**;Aug 23, 2005
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 QUIT
+5 ; Utilities supporting user options for logging
+6 ;
LOGONO ; Turn on logging
+1 NEW RESULT,DIR,DIRUT,DA,X,Y,DTM,%DT
+2 DO LOGINFOO
+3 WRITE !
+4 DO LOGINFO^MHVUL1(.RESULT)
+5 IF RESULT("DELETE")=""
SET RESULT("DELETE")=$$HTFM^XLFDT($HOROLOG+30,1)
+6 ;
+7 ; If logging is already on prompt if want to change deletion date
+8 IF RESULT("STATE")
Begin DoDot:1
+9 SET DIR(0)="Y"
+10 SET DIR("A",1)="Logging is already turned on."
+11 SET DIR("A")="Reset deletion date"
+12 SET DIR("?",1)="MHV application logging is already active."
+13 SET DIR("?")="You may enter a new deletion date for the log."
+14 SET DIR("B")="NO"
+15 DO ^DIR
+16 QUIT
End DoDot:1
if $DATA(DIRUT)!'Y
QUIT
+17 ;
+18 ; Prompt for deletion date
+19 KILL DIR,DIRUT,DA,X,Y
+20 SET DIR(0)="DA^"_DT_"::TX"
+21 SET DIR("A")="Log Deletion Date: "
+22 SET DIR("?",1)="Enter a future date to delete MHV application log."
+23 SET DIR("?",2)="After this date logging will automatically be stopped,"
+24 SET DIR("?")="and all log entries permanently deleted."
+25 SET DIR("B")=$$FMTE^XLFDT(RESULT("DELETE"),1)
+26 DO ^DIR
if $DATA(DIRUT)
QUIT
+27 ;
+28 DO LOGON^MHVUL1(.RESULT,Y)
+29 WRITE !!,"MHV application logging switched on."
+30 WRITE !,"Log will be deleted on "_$$FMTE^XLFDT($PIECE(RESULT,"^",2),1)_"."
+31 QUIT
+32 ;
LOGSETO ; Set logging parameters
+1 NEW RESULT,UPDATE,DIR,DIRUT,DA,X,Y,DTM,%DT,N,I
+2 DO LOGINFOO
+3 WRITE !
+4 DO LOGINFO^MHVUL1(.UPDATE)
+5 ;
+6 ; State ON/OFF
+7 KILL DIR,DIRUT,DA,X,Y
+8 SET DIR(0)="SA^1:ON;0:OFF"
+9 SET DIR("A")="Logging: "
+10 SET DIR("?")="Enter ON or OFF"
+11 SET DIR("B")=$SELECT(UPDATE("STATE"):"ON",1:"OFF")
+12 DO ^DIR
+13 if $DATA(DIRUT)
QUIT
+14 SET UPDATE("STATE")=Y
+15 ;
+16 ; Deletion Date
+17 KILL DIR,DIRUT,DA,X,Y
+18 SET DIR(0)="DA^"_DT_"::TX"
+19 SET DIR("A")="Log Deletion Date: "
+20 SET DIR("?",1)="Enter a future date to delete MHV application log."
+21 SET DIR("?",2)="After this date logging will automatically be stopped,"
+22 SET DIR("?")="and all log entries permanently deleted."
+23 SET DIR("B")=$$FMTE^XLFDT(UPDATE("DELETE"))
+24 DO ^DIR
if $DATA(DIRUT)
QUIT
+25 SET UPDATE("DELETE")=Y
+26 ;
+27 ; Logging Level
+28 KILL DIR,DIRUT,DA,X,Y
+29 SET DIR(0)="SA^E:ERROR;T:TRACE;N:NAMED;D:DEBUG"
+30 SET DIR("A")="Logging Level? "
+31 SET DIR("?",1)="Set logging level"
+32 SET DIR("?",2)="ERROR - only errors logged"
+33 SET DIR("?",3)="TRACE - Trace and errors logged"
+34 SET DIR("?",4)="NAMED - Named entries, trace and errors logged"
+35 SET DIR("?")="DEBUG - All entries logged"
+36 SET DIR("B")=UPDATE("LEVEL")
+37 DO ^DIR
+38 if $DATA(DIRUT)
QUIT
+39 SET UPDATE("LEVEL")=Y(0)
+40 ;
+41 ; Names
+42 IF UPDATE("LEVEL")="NAMED"
Begin DoDot:1
+43 SET N=UPDATE("NAMES")
+44 FOR I=2:1:$LENGTH(N,"^")
if $PIECE(N,"^",I)'=""
SET UPDATE("NAMES",$PIECE(N,"^",I))=""
+45 FOR
Begin DoDot:2
+46 KILL DIR,DIRUT,DA,X,Y
+47 SET DIR(0)="FO^"
+48 SET DIR("A")="Entry name"
+49 SET DIR("A",1)=UPDATE("NAMES")
+50 SET DIR("?",1)="Enter names of entries to log"
+51 SET DIR("?")="Remove entries by prefixing with @"
+52 SET DIR("B")=""
+53 DO ^DIR
+54 if $DATA(DIRUT)
QUIT
+55 IF $EXTRACT(Y)="@"
KILL UPDATE("NAMES",$EXTRACT(Y,2,$LENGTH(Y)))
+56 IF '$TEST
SET UPDATE("NAMES",Y)=""
+57 SET UPDATE("NAMES")="^"
SET N=""
+58 FOR
SET N=$ORDER(UPDATE("NAMES",N))
if N=""
QUIT
SET UPDATE("NAMES")=UPDATE("NAMES")_N_"^"
+59 QUIT
End DoDot:2
if $DATA(DIRUT)
QUIT
+60 QUIT
End DoDot:1
+61 ;
+62 ; Auto Purge ON/OFF
+63 KILL DIR,DIRUT,DA,X,Y
+64 SET DIR(0)="SA^1:ON;0:OFF"
+65 SET DIR("A")="Auto Purge: "
+66 SET DIR("?")="Enter ON or OFF"
+67 SET DIR("B")=$SELECT(UPDATE("AUTOPURGE"):"ON",1:"OFF")
+68 DO ^DIR
+69 if $DATA(DIRUT)
QUIT
+70 SET UPDATE("AUTOPURGE")=Y
+71 ;
+72 ; Days to Keep
+73 IF UPDATE("AUTOPURGE")
Begin DoDot:1
+74 IF 'UPDATE("DAYS")
SET UPDATE("DAYS")=7
+75 KILL DIR,DIRUT,DA,X,Y
+76 SET DIR(0)="N^1:365"
+77 SET DIR("A")="Days to Keep"
+78 SET DIR("?")="Enter number of days to keep log entries"
+79 SET DIR("B")=UPDATE("DAYS")
+80 DO ^DIR
+81 SET UPDATE("DAYS")=Y
+82 QUIT
End DoDot:1
if $DATA(DIRUT)
QUIT
+83 ;
+84 WRITE !!,"New MHV Application Log Settings:"
+85 DO LOGINFOD(.UPDATE)
+86 WRITE !
+87 SET DIR(0)="Y"
+88 SET DIR("A")="Ok to proceed with update"
+89 SET DIR("?")="Update logging parameters with those shown?"
+90 SET DIR("B")="NO"
+91 DO ^DIR
if $DATA(DIRUT)
QUIT
+92 IF 'Y
QUIT
+93 ;
+94 DO LOGSET^MHVUL1(.RESULT,.UPDATE)
+95 WRITE !!,"Logging parameters updated"
+96 DO LOGINFOO
+97 QUIT
+98 ;
LOGOFFO ;Turn off logging
+1 NEW RESULT,DIR,DIRUT,DA,X,Y
+2 DO LOGINFOO
+3 WRITE !
+4 DO LOGINFO^MHVUL1(.RESULT)
+5 ; Quit if logging is already off
+6 IF 'RESULT("STATE")
WRITE !,"Logging is already turned off."
QUIT
+7 SET DIR(0)="Y"
+8 SET DIR("A")="Turn off logging"
+9 SET DIR("?")="Turn off MHV application logging."
+10 SET DIR("B")="NO"
+11 DO ^DIR
if $DATA(DIRUT)
QUIT
+12 IF 'Y
QUIT
+13 ;
+14 DO LOGOFF^MHVUL1(.RESULT)
+15 WRITE !!,"MHV application logging switched off."
+16 WRITE !,"Log will be deleted on "_$$FMTE^XLFDT($PIECE(RESULT,"^",2),1)_"."
+17 QUIT
+18 ;
LOGPRGO ; Purge log
+1 NEW RESULT,DIR,DIRUT,DA,X,Y,DTM,%DT
+2 DO LOGINFOO
+3 WRITE !
+4 ; Purge from date
+5 SET DIR(0)="D^:"_DT_":TX"
+6 SET DIR("A")="Purge From Date"
+7 SET DIR("?",1)="Enter a past date to purge MHV application log."
+8 SET DIR("?")="All log entries older than this date will be removed."
+9 SET DIR("B")=$$HTE^XLFDT($HOROLOG-7,1)
+10 DO ^DIR
if $DATA(DIRUT)
QUIT
+11 SET DTM=Y
+12 ;
+13 ; Confirm Purge
+14 KILL DIR,DIRUT,DA,X,Y
+15 SET DIR(0)="Y"
+16 SET DIR("A",1)="Log will be purged from "_$$FMTE^XLFDT(DTM)_"."
+17 SET DIR("A")="OK to proceed"
+18 SET DIR("?")="All log entries older than this date will be removed."
+19 SET DIR("B")="NO"
+20 DO ^DIR
if $DATA(DIRUT)
QUIT
+21 if 'Y
QUIT
+22 ;
+23 DO LOGPRG^MHVUL1(.RESULT,DTM)
+24 WRITE !!,"Log purged from "_$$FMTE^XLFDT($PIECE(RESULT,"^",2),1)_"."
+25 QUIT
+26 ;
LOGINFOO ; Display log information
+1 NEW RESULT
+2 DO LOGINFO^MHVUL1(.RESULT)
+3 WRITE !!,"MHV Application Log Settings:"
+4 DO LOGINFOD(.RESULT)
+5 QUIT
+6 ;
LOGINFOD(RESULT) ; Display log
+1 WRITE !," Log Creation Date: ",$$FMTE^XLFDT(RESULT("CREATED"))
+2 WRITE !," Log Deletion Date: ",$$FMTE^XLFDT(RESULT("DELETE"))
+3 WRITE !," Oldest Entry: ",$$FMTE^XLFDT(RESULT("OLDEST"))
+4 WRITE !," Newest Entry: ",$$FMTE^XLFDT(RESULT("NEWEST"))
+5 WRITE !," Logging: ",$SELECT(RESULT("STATE"):"",1:"OFF")
+6 IF RESULT("STATE")
Begin DoDot:1
+7 WRITE RESULT("LEVEL")_" mode"
+8 IF RESULT("LEVEL")="NAMED"
WRITE !,?16,"Names: ",RESULT("NAMES")
+9 QUIT
End DoDot:1
+10 WRITE !," Auto Purge: ",$SELECT(RESULT("AUTOPURGE"):"",1:"OFF")
+11 IF RESULT("AUTOPURGE")
WRITE +RESULT("DAYS")," days"
+12 QUIT
+13 ;
LOGSIZEO ; Display log size information
+1 NEW RESULT
+2 DO LOGSIZE^MHVUL1(.RESULT)
+3 WRITE !!,"MHV Application Log Size:"
+4 DO LOGSIZED(.RESULT)
+5 QUIT
+6 ;
LOGSIZED(RESULT) ; Display log size
+1 WRITE !," Number of Entries: ",RESULT("ENTRY COUNT")
+2 WRITE !," Number of Nodes: ",RESULT("NODE COUNT")
+3 WRITE !," Approx. size in KB: ",RESULT("BYTE COUNT")\1024
+4 QUIT
+5 ;
LOGVIEWO ; View log
+1 NEW LOG,CNT,DTM,J,ENTRY,RESULT,DIR,DIRUT,DTOUT,DUOUT,DA,X,Y,DTM
+2 ; Use the browser if supported by emulation
+3 IF $$TEST^DDBRT
DO LOGBROWS^MHVUL2
QUIT
+4 KILL ^TMP("MHV LOG SUMMARY",$JOB)
+5 KILL ^TMP("MHV LOG DETAIL",$JOB)
+6 DO LOGSUM^MHVUL1(.LOG)
+7 SET CNT=$PIECE(@LOG,"^",2)
+8 IF CNT<1
DO LOGSUMD(LOG)
QUIT
+9 FOR
Begin DoDot:1
+10 DO LOGSUMD(LOG)
if $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+11 KILL DIR,X,DIRUT
+12 IF 'Y
Begin DoDot:2
+13 SET DIR(0)="N^1:"_CNT
+14 SET DIR("A")="Select Entry"
+15 SET DIR("?")="Select an entry to display"
+16 DO ^DIR
+17 QUIT
End DoDot:2
if $DATA(DIRUT)
QUIT
+18 ;
+19 SET DTM=$PIECE(@LOG@(Y),"^")
+20 SET J=$PIECE(@LOG@(Y),"^",2)
+21 DO LOGDET^MHVUL1(.ENTRY,DTM,J)
+22 DO LOGDETD(ENTRY)
+23 KILL @ENTRY
+24 QUIT
End DoDot:1
if $DATA(DIRUT)
QUIT
+25 KILL ^TMP("MHV LOG SUMMARY",$JOB)
+26 KILL ^TMP("MHV LOG DETAIL",$JOB)
+27 QUIT
+28 ;
LOGSUMD(LOG) ; Display log summary
+1 NEW CNT,DTM,J,N
+2 WRITE !!,"LOG SUMMARY"
+3 WRITE !,?5,"Entry",?12,"Timestamp",?37,"Job",?50,"Items"
+4 SET CNT=$PIECE(@LOG,"^",2)
+5 IF CNT<1
WRITE !!,?12,"EMPTY"
QUIT
+6 SET Y=0
+7 KILL DIRUT,DTOUT,DUOUT
+8 FOR I=1:1:CNT
Begin DoDot:1
+9 IF I#22=0
Begin DoDot:2
+10 KILL DIR,X,Y,DIRUT,DTOUT,DUOUT
+11 SET DIR(0)="NO^1:"_CNT
+12 SET DIR("A",1)="Press <RETURN> to see more, '^' to exit, OR"
+13 SET DIR("A")="Select Entry"
+14 SET DIR("?")="Select an entry to display"
+15 DO ^DIR
+16 QUIT
End DoDot:2
if Y!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+17 SET DTM=$$FMTE^XLFDT(-$PIECE(@LOG@(I),"^"))
+18 SET J=$PIECE(@LOG@(I),"^",2)
+19 SET N=$PIECE(@LOG@(I),"^",3)
+20 WRITE !,?5,I,?12,DTM,?37,J,?50,N
+21 QUIT
End DoDot:1
if Y!$DATA(DTOUT)!$DATA(DUOUT)
QUIT
+22 QUIT
+23 ;
LOGDETD(ENTRY) ;Display log entry
+1 NEW CNT,DTM,J,N
+2 WRITE !!,"LOG DETAIL"
+3 SET CNT=$PIECE(@ENTRY,"^",2)
+4 IF CNT<1
WRITE !,?12,"EMPTY"
QUIT
+5 WRITE !,?12,"Timestamp",?37,"Job",?50,"Items",?60,"Nodes"
+6 SET DTM=$$FMTE^XLFDT(-$PIECE(@ENTRY@(0),"^"))
+7 SET J=$PIECE(@ENTRY@(0),"^",2)
+8 SET N=$PIECE(@ENTRY@(0),"^",3)
+9 WRITE !,?12,DTM,?37,J,?50,N,?60,CNT
+10 SET J=3
+11 FOR I=1:1:CNT
Begin DoDot:1
+12 SET J=($LENGTH(@ENTRY@(I))+5)\80+1+J
+13 IF J>23
Begin DoDot:2
+14 KILL DIR,X,Y,DIRUT
+15 SET DIR(0)="E"
+16 DO ^DIR
+17 SET J=($LENGTH(@ENTRY@(I))+5)\80+1
+18 QUIT
End DoDot:2
if $DATA(DIRUT)
QUIT
+19 WRITE !,?5,@ENTRY@(I)
+20 QUIT
End DoDot:1
if $DATA(DIRUT)
QUIT
+21 ;
+22 if $DATA(DIRUT)
QUIT
+23 KILL DIR,X,Y,DIRUT
+24 SET DIR(0)="E"
+25 DO ^DIR
+26 QUIT
+27 ;