IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4951 for trunk/psLib/test/sys


Ignore:
Timestamp:
Sep 6, 2005, 2:15:51 PM (21 years ago)
Author:
drobbin
Message:

Updated/changed psTrace & psLog fxns to use fd (were FILE*) as described in SDRS

Location:
trunk/psLib/test/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/sys/tst_psLogMsg.c

    r4547 r4951  
    77#include "pslib_strict.h"
    88#include "psTest.h"
     9#include <unistd.h>
     10#include <fcntl.h>
    911
    1012static psS32 testLogMsg00();
     
    176178{
    177179    psS32 i = 0;
    178     FILE* file;
    179     char line[256];
     180    //    FILE* file;
     181    int fd;
     182    //    char line[256];
    180183
    181184    printf("--------------- psLogSetDestination(PS_LOG_NONE) ----------------\n");
    182     psLogSetDestination("none");
     185    //    psLogSetDestination("none");
     186    psLogSetDestination(0);
    183187    for (i=0;i<10;i++) {
    184188        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     
    186190
    187191    printf("------------- psLogSetDestination(PS_LOG_TO_STDERR) -------------\n");
    188     psLogSetDestination("dest:stderr");
     192    //    psLogSetDestination("dest:stderr");
     193    psLogSetDestination(2);
    189194    for (i=0;i<10;i++) {
    190195        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     
    192197
    193198    printf("------------- psLogSetDestination(PS_LOG_TO_STDOUT) -------------\n");
    194     psLogSetDestination("dest:stdout");
    195     for (i=0;i<10;i++) {
    196         psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
    197     }
     199    //    psLogSetDestination("dest:stdout");
     200    psLogSetDestination(1);
     201    for (i=0;i<10;i++) {
     202        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     203    }
     204
    198205    printf("--------------- psLogSetDestination(""file:log.txt"") ---------------\n");
    199     psLogSetDestination("file:log.txt");
    200     for (i=0;i<10;i++) {
    201         psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
    202     }
    203 
    204     psLogSetDestination("none");
     206    fd = creat("log.txt", 0666);
     207    //    psLogSetDestination("file:log.txt");
     208    psLogSetDestination(fd);
     209    for (i=0;i<10;i++) {
     210        psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     211    }
     212
     213
     214    //    psLogSetDestination("none");
     215    FILE *file;
     216    char line[257];
     217    //    psLogSetDestination(-1);
     218    psLogSetDestination(0);
    205219    printf("--------------------- The Contents of log.txt -------------------\n");
    206220    file = fopen("log.txt","r");
     
    209223    }
    210224    fclose(file);
    211 
     225    close(fd);
     226
     227    int fd2 = creat("/eva/log.txt", 0666);
    212228    printf("--------------- psLogSetDestination(""file:/eva/log.txt"") ----------\n");
    213     psLogSetDestination("file:/eva/log.txt");
     229    //    psLogSetDestination("file:/eva/log.txt");
     230    psLogSetDestination(fd2);
    214231    for ( i=0;i<10;i++) {
    215232        psLogMsg(__func__, i, "Hello World! My level is %d\n", i);
    216233    }
    217 
    218     return 0;
    219 }
     234    close(fd2);
     235
     236    return 0;
     237}
  • trunk/psLib/test/sys/tst_psTrace.c

    r4944 r4951  
    103103    (void)psTraceSetLevel(".A.B.C.D.E", 5);
    104104
    105     psTrace(".A.C.D.C",1,"You should not see this.\n");
    106     psTrace(".A.B.C.D.E",2,"You should see this.\n");
    107     psTrace(".A.B.C.D.E.F",3,"You should see this too.\n");
     105    psTrace(".A.C.D.C",1," ","You should not see this.\n");
     106    psTrace(".A.B.C.D.E",2," ","You should see this.\n");
     107    psTrace(".A.B.C.D.E.F",3," ","You should see this too.\n");
    108108
    109109    psTracePrintLevels();
     
    208208
    209209        (void)psTraceSetLevel(".", 4);
    210         psTrace(".", 5, "(0) This message should not be displayed (%x)\n",
     210        psTrace(".", 5, " ", "(0) This message should not be displayed (%x)\n",
    211211                0xbeefface);
    212212        (void)psTraceSetLevel(".", 7);
    213         psTrace(".", 5, "(0) This message should be displayed (%x)\n",
     213        psTrace(".", 5, " ", "(0) This message should be displayed (%x)\n",
    214214                0xbeefface);
    215215
    216216        (void)psTraceSetLevel(".a", 4);
    217         psTrace(".a", 5, "(1) This message should not be displayed (%x)\n",
     217        psTrace(".a", 5, " ", "(1) This message should not be displayed (%x)\n",
    218218                0xbeefface);
    219219        (void)psTraceSetLevel(".a", 7);
    220         psTrace(".a", 5, "(1) This message should be displayed (%x)\n",
     220        psTrace(".a", 5, " ", "(1) This message should be displayed (%x)\n",
    221221                0xbeefface);
    222222
    223223
    224224        (void)psTraceSetLevel(".a.b", 4);
    225         psTrace(".a.b", 5, "(2) This message should not be displayed (%x)\n",
     225        psTrace(".a.b", 5, " ", "(2) This message should not be displayed (%x)\n",
    226226                0xbeefface);
    227227        (void)psTraceSetLevel(".a.b", 7);
    228         psTrace(".a.b", 5, "(2) This message should be displayed (%x)\n",
     228        psTrace(".a.b", 5, " ", "(2) This message should be displayed (%x)\n",
    229229                0xbeefface);
    230230
Note: See TracChangeset for help on using the changeset viewer.