EDPCDBG ;SLC/KCM - Debugging for Controller ;2/28/12 08:33am
;;2.0;EMERGENCY DEPARTMENT;;May 2, 2012;Build 103
;
DEBUG(SWFID) ; return TRUE if debugging
N CTS,DTS,DIF
S CTS=$H,DTS=$$GET^XPAR("SYS","EDPF DEBUG START TIME",1,"I")
Q:'DTS 0 ;no debug param
Q:($P(CTS,",")'=$P(DTS,",")) 0 ;not the same day
S DIF=$P(CTS,",",2)-$P(DTS,",",2)
I DIF<0 Q 0 ;future debug time
I DIF<1800 Q $$NEXTSEQ(SWFID) ;TRUE, within 30 minutes of start
Q 0
;
NEXTSEQ(LOGID) ; return sequence for this session as EDPF-DEBUG-LOG-swfid^sequence
S:'$L(LOGID) LOGID="init"
I '$D(^XTMP("EDP-DEBUG-LOG",0)) S ^XTMP("EDP-DEBUG-LOG",0)=$$FMADD^XLFDT(DT,1)_U_DT_U_"ED debug log"
L +^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ"):2 E Q 0
S ^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ")=+$G(^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ"))+1
L -^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ")
Q ^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ")_U_LOGID
;
PUTREQ(SEQ,REQ) ; save the request at this sequence number
M ^XTMP("EDP-DEBUG-LOG",$P(SEQ,U,2),+SEQ,"REQ")=REQ
Q
PUTXML(SEQ,XML) ; save the XML result at this sequence number
M ^XTMP("EDP-DEBUG-LOG",$P(SEQ,U,2),+SEQ,"XML")=XML
Q
;
SETON ; turn on debugging for EDIS
N DIR,X,Y
W !,"Enable EDIS Debugging Log"
W !,"Logging will occur for 30 minutes after start time."
W !,"Log is stored in ^XTMP(""EDP-DEBUG-LOG"")",!
S DIR(0)="DO^::EFR"
S DIR("A")="Logging Start Time"
S DIR("B")="NOW"
D ^DIR
Q:'Y
K ^XTMP("EDP-DEBUG-LOG")
D EN^XPAR("SYS","EDPF DEBUG START TIME",1,$$FMTH^XLFDT(Y))
Q
SETOFF ; turn off debugging for EDIS
W !,"EDIS Debugging Log Stopped"
D DEL^XPAR("SYS","EDPF DEBUG START TIME",1)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEDPCDBG 1698 printed Oct 16, 2024@17:52:30 Page 2
EDPCDBG ;SLC/KCM - Debugging for Controller ;2/28/12 08:33am
+1 ;;2.0;EMERGENCY DEPARTMENT;;May 2, 2012;Build 103
+2 ;
DEBUG(SWFID) ; return TRUE if debugging
+1 NEW CTS,DTS,DIF
+2 SET CTS=$HOROLOG
SET DTS=$$GET^XPAR("SYS","EDPF DEBUG START TIME",1,"I")
+3 ;no debug param
if 'DTS
QUIT 0
+4 ;not the same day
if ($PIECE(CTS,",")'=$PIECE(DTS,","))
QUIT 0
+5 SET DIF=$PIECE(CTS,",",2)-$PIECE(DTS,",",2)
+6 ;future debug time
IF DIF<0
QUIT 0
+7 ;TRUE, within 30 minutes of start
IF DIF<1800
QUIT $$NEXTSEQ(SWFID)
+8 QUIT 0
+9 ;
NEXTSEQ(LOGID) ; return sequence for this session as EDPF-DEBUG-LOG-swfid^sequence
+1 if '$LENGTH(LOGID)
SET LOGID="init"
+2 IF '$DATA(^XTMP("EDP-DEBUG-LOG",0))
SET ^XTMP("EDP-DEBUG-LOG",0)=$$FMADD^XLFDT(DT,1)_U_DT_U_"ED debug log"
+3 LOCK +^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ"):2
IF '$TEST
QUIT 0
+4 SET ^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ")=+$GET(^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ"))+1
+5 LOCK -^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ")
+6 QUIT ^XTMP("EDP-DEBUG-LOG",LOGID,"SEQ")_U_LOGID
+7 ;
PUTREQ(SEQ,REQ) ; save the request at this sequence number
+1 MERGE ^XTMP("EDP-DEBUG-LOG",$PIECE(SEQ,U,2),+SEQ,"REQ")=REQ
+2 QUIT
PUTXML(SEQ,XML) ; save the XML result at this sequence number
+1 MERGE ^XTMP("EDP-DEBUG-LOG",$PIECE(SEQ,U,2),+SEQ,"XML")=XML
+2 QUIT
+3 ;
SETON ; turn on debugging for EDIS
+1 NEW DIR,X,Y
+2 WRITE !,"Enable EDIS Debugging Log"
+3 WRITE !,"Logging will occur for 30 minutes after start time."
+4 WRITE !,"Log is stored in ^XTMP(""EDP-DEBUG-LOG"")",!
+5 SET DIR(0)="DO^::EFR"
+6 SET DIR("A")="Logging Start Time"
+7 SET DIR("B")="NOW"
+8 DO ^DIR
+9 if 'Y
QUIT
+10 KILL ^XTMP("EDP-DEBUG-LOG")
+11 DO EN^XPAR("SYS","EDPF DEBUG START TIME",1,$$FMTH^XLFDT(Y))
+12 QUIT
SETOFF ; turn off debugging for EDIS
+1 WRITE !,"EDIS Debugging Log Stopped"
+2 DO DEL^XPAR("SYS","EDPF DEBUG START TIME",1)
+3 QUIT