IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7587


Ignore:
Timestamp:
Jun 16, 2006, 1:01:10 PM (20 years ago)
Author:
drobbin
Message:

Edited psMessageDestination to correctly set logFD. Updated tests - removed dest from "dest:stdout". (Code no longer requires "dest")

Location:
trunk/psLib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psLogMsg.c

    r7569 r7587  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2006-06-15 00:17:32 $
     13 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-16 23:01:10 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    186186    // Special destinations: stdout, stderr
    187187    if (strcmp(dest, "stdout") == 0) {
     188        logFD = STDOUT_FILENO;
    188189        return STDOUT_FILENO;
    189190    }
    190191    if (strcmp(dest, "stderr") == 0) {
     192        logFD = STDERR_FILENO;
    191193        return STDERR_FILENO;
    192194    }
     
    213215        }
    214216        psFree(protocolLocation);
     217        logFD = fileD;
    215218        return fileD;
    216219    }
  • trunk/psLib/src/sys/psLogMsg.h

    r5072 r7587  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-09-20 02:43:53 $
     13 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-06-16 23:01:10 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2727
    2828/** This procedure sets the destination for future log messages.
    29  *  This procedure will take a character string as an
    30  *  argument which can specify general log destinations.
     29 *
     30 *  This procedure will take an integer as an argument
     31 *  which can specify general log destinations.
    3132 *
    3233 *  @return bool     true if set successfully, otherwise false.
     
    7677/** This procedures uses a string to set the destination for which to send
    7778 *  the corresponding log messages.
    78  *
    7979 *
    8080 *  @return int:        The file descriptor location of the message.
  • trunk/psLib/test/sys/tst_psLogMsg.c

    r5072 r7587  
    234234    close(fd);
    235235
    236     int fd2 = creat("/eva/log.txt", 0666);
    237     printf("--------------- psLogSetDestination(""file:/eva/log.txt"") ----------\n");
     236    int fd2 = creat("eva/log.txt", 0666);
     237    printf("--------------- psLogSetDestination(""file:eva/log.txt"") ----------\n");
    238238    //    psLogSetDestination("file:/eva/log.txt");
    239239    psLogSetDestination(fd2);
     
    261261
    262262    printf("------------- psMessageDestination(PS_LOG_TO_STDERR) -------------\n");
    263     psMessageDestination("dest:stderr");
     263    psMessageDestination("stderr");
    264264    //    psLogSetDestination(2);
    265265    for (i=0;i<10;i++) {
    266         psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     266        psLogMsg(__func__, i, "Hello World!  My level is %d - stderr\n", i);
    267267    }
    268268
    269269    printf("------------- psMessageDestination(PS_LOG_TO_STDOUT) -------------\n");
    270     psMessageDestination("dest:stdout");
     270    psMessageDestination("stdout");
    271271    //    psLogSetDestination(1);
    272272    for (i=0;i<10;i++) {
    273         psLogMsg(__func__, i, "Hello World!  My level is %d\n", i);
     273        psLogMsg(__func__, i, "Hello World!  My level is %d - stdout\n", i);
    274274    }
    275275
     
    296296    close(fd);
    297297
    298     int fd2 = creat("/eva/log2.txt", 0666);
    299     printf("--------------- psMessageDestination(""file:/eva/log.txt"") ----------\n");
    300     psMessageDestination("file:/eva/log2.txt");
     298    int fd2 = creat("eva/log2.txt", 0666);
     299    printf("--------------- psMessageDestination(""file:eva/log.txt"") ----------\n");
     300    psMessageDestination("file:eva/log2.txt");
    301301    //    psLogSetDestination(fd2);
    302302    for ( i=0;i<10;i++) {
  • trunk/psLib/test/sys/verified/tst_psLogMsg.stderr

    r7348 r7587  
    200200    Hello World!  My level is 3
    201201<DATE><TIME>|<HOST>|A|testLogMsg06
    202     Hello World!  My level is 0
     202    Hello World!  My level is 0 - stderr
    203203<DATE><TIME>|<HOST>|E|testLogMsg06
    204     Hello World!  My level is 1
     204    Hello World!  My level is 1 - stderr
    205205<DATE><TIME>|<HOST>|W|testLogMsg06
    206     Hello World!  My level is 2
     206    Hello World!  My level is 2 - stderr
    207207<DATE><TIME>|<HOST>|I|testLogMsg06
    208     Hello World!  My level is 3
    209 <DATE><TIME>|<HOST>|A|testLogMsg06
    210     Hello World! My level is 0
    211 <DATE><TIME>|<HOST>|E|testLogMsg06
    212     Hello World! My level is 1
    213 <DATE><TIME>|<HOST>|W|testLogMsg06
    214     Hello World! My level is 2
    215 <DATE><TIME>|<HOST>|I|testLogMsg06
    216     Hello World! My level is 3
     208    Hello World!  My level is 3 - stderr
    217209
    218210---> TESTPOINT PASSED (psLogMsg{psMessageDestination()} | tst_psLogMsg.c)
  • trunk/psLib/test/sys/verified/tst_psLogMsg.stdout

    r5072 r7587  
     1<DATE><TIME>|<HOST>|A|testLogMsg05
     2    Hello World!  My level is 0
    13--------------- psLogSetDestination(PS_LOG_NONE) ----------------
    24    File Descriptor = 0
     
    57------------- psLogSetDestination(PS_LOG_TO_STDOUT) -------------
    68    File Descriptor = 1
    7 <DATE><TIME>|<HOST>|A|testLogMsg05
    8     Hello World!  My level is 0
    99<DATE><TIME>|<HOST>|E|testLogMsg05
    1010    Hello World!  My level is 1
     
    2424<DATE><TIME>|<HOST>|I|testLogMsg05
    2525    Hello World!  My level is 3
    26 --------------- psLogSetDestination(file:/eva/log.txt) ----------
     26--------------- psLogSetDestination(file:eva/log.txt) ----------
     27<DATE><TIME>|<HOST>|A|testLogMsg06
     28    Hello World!  My level is 0 - stdout
    2729--------------- psMessageDestination(PS_LOG_NONE) ----------------
    2830------------- psMessageDestination(PS_LOG_TO_STDERR) -------------
    2931------------- psMessageDestination(PS_LOG_TO_STDOUT) -------------
    30 <DATE><TIME>|<HOST>|A|testLogMsg06
    31     Hello World!  My level is 0
    3232<DATE><TIME>|<HOST>|E|testLogMsg06
    33     Hello World!  My level is 1
     33    Hello World!  My level is 1 - stdout
    3434<DATE><TIME>|<HOST>|W|testLogMsg06
    35     Hello World!  My level is 2
     35    Hello World!  My level is 2 - stdout
    3636<DATE><TIME>|<HOST>|I|testLogMsg06
    37     Hello World!  My level is 3
     37    Hello World!  My level is 3 - stdout
    3838--------------- psMessageDestination(file:log2.txt) ---------------
    3939--------------------- The Contents of log2.txt -------------------
     
    4646<DATE><TIME>|<HOST>|I|testLogMsg06
    4747    Hello World!  My level is 3
    48 --------------- psMessageDestination(file:/eva/log.txt) ----------
     48--------------- psMessageDestination(file:eva/log.txt) ----------
Note: See TracChangeset for help on using the changeset viewer.