source: FOIAVistA/trunk/r/RPC_BROKER-XWB/XWBDLOG.m@ 1742

Last change on this file since 1742 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.9 KB
Line 
1XWBDLOG ;ISF/RWF - Debug Logging for Broker ;12/08/2004 08:54
2 ;;1.1;RPC BROKER;**35**;Mar 28, 1997
3 Q
4 ;
5 ;Setup the log, Clear the log location.
6LOGSTART(RTN) ;Clear the debug log
7 Q:'$G(XWBDEBUG)
8 K ^XTMP("XWBLOG"_$J)
9 S ^XTMP("XWBLOG"_$J,0)=$$HTFM^XLFDT($$HADD^XLFDT($H,7))_"^"_$$DT^XLFDT
10 S ^XTMP("XWBLOG"_$J,.1)=0
11 D LOG("Log start: "_$$HTE^XLFDT($H)),LOG(RTN)
12 Q
13LOG(MSG) ;Record Debug Info
14 Q:'$G(XWBDEBUG)
15 N CNT
16 S CNT=1+$G(^XTMP("XWBLOG"_$J,.1)),^(.1)=CNT,^(CNT)=$E($H_"^"_MSG,1,255)
17 Q
18 ;
19 ;
20VIEW ;View log files
21 N DIRUT,XWB,DIR,IX,X,CON
22 D HOME^%ZIS
23 W !,"Log Files"
24 S XWB="XWBLOG",CON=""
25 F S XWB=$O(^XTMP(XWB)) Q:XWB'["XWBLOG" D
26 . D V1(.XWB)
27 . I $$WAIT(.CON) S:CON=3 XWB="XWC"
28 . Q
29 Q
30 ;
31V1(XWB) ;View one log
32 N IX,X,CNT
33 S IX=.9,X=$G(^XTMP(XWB,IX)),CON=0,CNT=+$G(^XTMP(XWB,.1))
34 Q:CNT<1
35 W !!,"Log from Job ",$E(XWB,7,99)," ",CNT," Lines"
36 F S IX=$O(^XTMP(XWB,IX)) Q:'$L(IX) S X=^XTMP(XWB,IX) D VL1(IX,X)
37 Q
38 ;
39VL1(J,K) ;Write a line
40 I $Y'<IOSL,$$WAIT(.CON) S IX="A" S:CON=3 XWB="XWC" Q
41 Q:'$D(^XTMP(XWB,IX))
42 N H,D,T,I
43 S H=$P($$HTE^XLFDT($P(K,"^"),"2S"),"@",2)_" = "
44 S D=$P(K,"^",2,99),K=D
45 I D?.E1C.E D
46 . S D=""
47 . F I=1:1:$L(K) S T=$A(K,I),D=D_$S(T>31:$E(K,I),1:"\"_$E((1000+T),3,4))
48 S T=$L(H)
49 F W !,H,?T,$E(D,1,68) S H="",D=$E(D,69,999) Q:'$L(D)
50 Q
51 ;
52WAIT(CON) ;continue/kill/exit
53 S DIR("?")="Enter RETURN to continue, Next for next log, Kill to remove log, Exit to quit log view."
54 S DIR("A")="Return to continue, Next log, Exit: "
55 S DIR(0)="SAB^1:Continue;2:Next;3:Exit;4:Kill",DIR("B")="Continue"
56 D ^DIR
57 S CON=+Y
58 I Y=4 D K1(XWB,0) H 1
59 I Y=1 W @IOF
60 Q Y>1
61 ;
62K1(REF,S) ;Kill one
63 I REF["XWBLOG" K ^XTMP(REF)
64 I 'S W !,"Log "_REF_" deleted."
65 Q
66 ;
67KILLALL ;KILL ALL LOG Entries
68 N DIR,XWB
69 S DIR(0)="Y",DIR("A")="Remove all XWB log entries",DIR("B")="No"
70 D ^DIR Q:Y'=1
71 S XWB="XWBLOG"
72 F S XWB=$O(^XTMP(XWB)) Q:XWB'["XWBLOG" D K1(XWB,1)
73 W !,"Done"
74 Q
Note: See TracBrowser for help on using the repository browser.