IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4180


Ignore:
Timestamp:
Jun 8, 2005, 8:12:31 PM (21 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psLib/src
Files:
3 edited

Legend:

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

    r4162 r4180  
    33 *  \ingroup LogTrace
    44 *
    5  *  This file will hold the prototypes for defining procedure which set
    6  *  message log levels, messahe log formats, message log destinations, and
    7  *  for generating the messages themselves.
     5 *  This file contains code for setting message log levels, message log
     6 *  formats, message log destinations, and for generating the messages
     7 *  themselves.
    88 *  @ingroup LogTrace
    99 *
    1010 *  @author Robert Lupton, Princeton University
    11  *  @author George Gusciora, MHPCC
     11 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-08 23:40:45 $
     13 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-09 06:12:31 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6161 level (psS32): the new log level.
    6262Output:
    63  none
    64 Return:
    6563 The old log level.
    6664 *****************************************************************************/
     
    8280
    8381/*****************************************************************************
    84 psLogSetDestination(): sets the destination where log messages will be
    85 sent to.
    86  
     82psLogSetDestination(): sets the log message destination.
    8783Input:
    8884 dest (psS32): the new log destination
    89 Output:
    90  None.
    9185Return:
    92  An integer specifying the old log destination.
     86 An psBool: TRUE if successful.
    9387 *****************************************************************************/
    9488psBool psLogSetDestination(const char *dest)
     
    132126            return true;
    133127        }
    134         psError(PS_ERR_LOCATION_INVALID, true,
    135                 PS_ERRORTEXT_psLogMsg_DEST_LOCATION_INVALID,
     128        psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_DEST_LOCATION_INVALID,
    136129                location);
    137130        return 1;
     
    140133
    141134        if (file == NULL) {
    142             psError(PS_ERR_IO, true,
    143                     PS_ERRORTEXT_psLogMsg_OPEN_FILE_FAILED,
     135            psError(PS_ERR_IO, true, PS_ERRORTEXT_psLogMsg_OPEN_FILE_FAILED,
    144136                    location);
    145137            return false;
     
    152144    }
    153145
    154     psError(PS_ERR_LOCATION_INVALID, true,
    155             PS_ERRORTEXT_psLogMsg_UNSUPPORTED_PROTOCOL,
     146    psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_UNSUPPORTED_PROTOCOL,
    156147            protocol);
    157148    return false;
     
    168159Input:
    169160    fmt: a string specifying the format.
    170 Output:
    171     none.
    172161Return:
    173162    NULL.
     
    175164void psLogSetFormat(const char *fmt)
    176165{
    177     // assume nothing desired unless specified
     166    // assume none.
    178167    logHost = false;
    179168    logLevel = false;
     
    187176    }
    188177
     178    // XXX: What is the purpose of this conditional.
    189179    if (strlen(fmt) == 0) {
    190180        fmt = "THLNM";
    191181    }
    192182    // Step through each character in the format string.  For each letter
    193     // in that string, set/unset the appropriate logging.
     183    // in that string, set the appropriate logging.
    194184
    195185    for (const char *ptr = fmt; *ptr != '\0'; ptr++) {
     
    222212    }
    223213
     214    // XXX: If one must at least log error messages, why don't we set logMsg = true here?
    224215    if (!logMsg) {
    225216        psTrace("utils.logMsg", 1, "You must at least log error messages (You chose \"%s\")", fmt);
     
    232223
    233224/*****************************************************************************
    234     psVLogMsg(): This routine sends the message, which is a printf style
    235  string specified in the "..." argument, to the current message log
    236  destination with the severity specified by the "level" argument.
    237     Input:
    238  name
    239  level
    240  fmt
    241  ap
    242     Output:
    243  none
    244     Return:
    245  NULL.
     225psVLogMsg(): This routine sends the message, which is a printf style string
     226specified in the "..." argument, to the current message log destination with
     227the severity specified by the "level" argument.
     228 Input:
     229   name
     230   level
     231   fmt
     232   ap
    246233 *****************************************************************************/
    247234void psLogMsgV(const char *name, psS32 level, const char *fmt, va_list ap)
     
    361348
    362349/*****************************************************************************
    363     psLogMsg(): This routine sends the message, which is a printf style
    364  string specified in the "..." argument, to the current message log
    365  destination with the severity specified by the "level" argument.
    366     Input:
    367  name: Indicates the source of this log message.
    368  level: The severity of this log message.
    369  fmt: The printf-stype formatted string, followed by the arguments
    370   to that string.
    371  ... The arguments to the above printf-style string.
    372     Output:
    373  none
    374     Return:
    375  NULL
     350psLogMsg(): This routine sends the message, which is a printf style string
     351specified in the "..." argument, to the current message log destination with
     352the severity specified by the "level" argument.
     353 
     354Input:
     355  name: Indicates the source of this log message.
     356  level: The severity of this log message.
     357  fmt: The printf-stype formatted string, followed by the arguments
     358        to that string.
     359  ... The arguments to the above printf-style string.
     360 
     361Return:
     362   NULL
    376363 *****************************************************************************/
    377364void psLogMsg(const char *name, psS32 level, const char *fmt, ...)
  • trunk/psLib/src/sys/psLogMsg.h

    r4162 r4180  
    99 *
    1010 *  @author Robert Lupton, Princeton University
    11  *  @author George Gusciora, MHPCC
     11 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-08 23:40:45 $
     13 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-09 06:12:31 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2626 */
    2727
    28 /** This procedure sets the destination for future log messages.  Currently
    29  *  the destination is specified by an integer which can have the following
    30  *  pre-defined values: PS_LOG_NONE, PS_LOG_TO_STDOUT, and PS_LOG_TO_STDERR.
    31  *  In future versions, this procedure will take a character string as an
    32  *  argument which can specify more general log destinations.
     28/** 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.
    3331 *
    3432 *  @return psS32     true if set successfully, otherwise false.
     
    4240 *  "mylevel" is less than the current log level set by this procedure.
    4341 *  Ie. higher values set by this procedure will cause more log messages to
    44  *  be displayed.
     42 *  be displayed.  The old log level will be returned.
    4543 *
    4644 *  @return psS32    old logging level
     
    5452 *  (level), M (message), N (name), and T (time).  The default is "THLNM".
    5553 *  Deleting a letter from the string will cause the associated information
    56  *  to not be logged.
    57  *
     54 *  to not be logged.  This procedure does not alter the order in which
     55 *  the messages are displayed.
    5856 */
    5957void psLogSetFormat(
     
    6462 *  call to psLogSetDestination(), if myLevel is less than the level
    6563 *  specified by a prior call to psLogSetLevel().  The message is specified
    66  *  with a printf-stype string an arguments.
     64 *  with a printf-type string and arguments.
    6765 *
    6866 */
  • trunk/psLib/src/sysUtils/psLogMsg.c

    r4162 r4180  
    33 *  \ingroup LogTrace
    44 *
    5  *  This file will hold the prototypes for defining procedure which set
    6  *  message log levels, messahe log formats, message log destinations, and
    7  *  for generating the messages themselves.
     5 *  This file contains code for setting message log levels, message log
     6 *  formats, message log destinations, and for generating the messages
     7 *  themselves.
    88 *  @ingroup LogTrace
    99 *
    1010 *  @author Robert Lupton, Princeton University
    11  *  @author George Gusciora, MHPCC
     11 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-08 23:40:45 $
     13 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-06-09 06:12:31 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6161 level (psS32): the new log level.
    6262Output:
    63  none
    64 Return:
    6563 The old log level.
    6664 *****************************************************************************/
     
    8280
    8381/*****************************************************************************
    84 psLogSetDestination(): sets the destination where log messages will be
    85 sent to.
    86  
     82psLogSetDestination(): sets the log message destination.
    8783Input:
    8884 dest (psS32): the new log destination
    89 Output:
    90  None.
    9185Return:
    92  An integer specifying the old log destination.
     86 An psBool: TRUE if successful.
    9387 *****************************************************************************/
    9488psBool psLogSetDestination(const char *dest)
     
    132126            return true;
    133127        }
    134         psError(PS_ERR_LOCATION_INVALID, true,
    135                 PS_ERRORTEXT_psLogMsg_DEST_LOCATION_INVALID,
     128        psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_DEST_LOCATION_INVALID,
    136129                location);
    137130        return 1;
     
    140133
    141134        if (file == NULL) {
    142             psError(PS_ERR_IO, true,
    143                     PS_ERRORTEXT_psLogMsg_OPEN_FILE_FAILED,
     135            psError(PS_ERR_IO, true, PS_ERRORTEXT_psLogMsg_OPEN_FILE_FAILED,
    144136                    location);
    145137            return false;
     
    152144    }
    153145
    154     psError(PS_ERR_LOCATION_INVALID, true,
    155             PS_ERRORTEXT_psLogMsg_UNSUPPORTED_PROTOCOL,
     146    psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_UNSUPPORTED_PROTOCOL,
    156147            protocol);
    157148    return false;
     
    168159Input:
    169160    fmt: a string specifying the format.
    170 Output:
    171     none.
    172161Return:
    173162    NULL.
     
    175164void psLogSetFormat(const char *fmt)
    176165{
    177     // assume nothing desired unless specified
     166    // assume none.
    178167    logHost = false;
    179168    logLevel = false;
     
    187176    }
    188177
     178    // XXX: What is the purpose of this conditional.
    189179    if (strlen(fmt) == 0) {
    190180        fmt = "THLNM";
    191181    }
    192182    // Step through each character in the format string.  For each letter
    193     // in that string, set/unset the appropriate logging.
     183    // in that string, set the appropriate logging.
    194184
    195185    for (const char *ptr = fmt; *ptr != '\0'; ptr++) {
     
    222212    }
    223213
     214    // XXX: If one must at least log error messages, why don't we set logMsg = true here?
    224215    if (!logMsg) {
    225216        psTrace("utils.logMsg", 1, "You must at least log error messages (You chose \"%s\")", fmt);
     
    232223
    233224/*****************************************************************************
    234     psVLogMsg(): This routine sends the message, which is a printf style
    235  string specified in the "..." argument, to the current message log
    236  destination with the severity specified by the "level" argument.
    237     Input:
    238  name
    239  level
    240  fmt
    241  ap
    242     Output:
    243  none
    244     Return:
    245  NULL.
     225psVLogMsg(): This routine sends the message, which is a printf style string
     226specified in the "..." argument, to the current message log destination with
     227the severity specified by the "level" argument.
     228 Input:
     229   name
     230   level
     231   fmt
     232   ap
    246233 *****************************************************************************/
    247234void psLogMsgV(const char *name, psS32 level, const char *fmt, va_list ap)
     
    361348
    362349/*****************************************************************************
    363     psLogMsg(): This routine sends the message, which is a printf style
    364  string specified in the "..." argument, to the current message log
    365  destination with the severity specified by the "level" argument.
    366     Input:
    367  name: Indicates the source of this log message.
    368  level: The severity of this log message.
    369  fmt: The printf-stype formatted string, followed by the arguments
    370   to that string.
    371  ... The arguments to the above printf-style string.
    372     Output:
    373  none
    374     Return:
    375  NULL
     350psLogMsg(): This routine sends the message, which is a printf style string
     351specified in the "..." argument, to the current message log destination with
     352the severity specified by the "level" argument.
     353 
     354Input:
     355  name: Indicates the source of this log message.
     356  level: The severity of this log message.
     357  fmt: The printf-stype formatted string, followed by the arguments
     358        to that string.
     359  ... The arguments to the above printf-style string.
     360 
     361Return:
     362   NULL
    376363 *****************************************************************************/
    377364void psLogMsg(const char *name, psS32 level, const char *fmt, ...)
Note: See TracChangeset for help on using the changeset viewer.