Skip to content
  • Steven Murray's avatar
    Added the CASTOR_DLF_WRITEPC macro. · b63bb04d
    Steven Murray authored
    This macro should be used when it is desirable to include the file, line and
    function context information in a log.  It is advised to include such
    information when logging an error for the developers, but not to use it for
    monitoring logs where operators are informed of what is happening and they do
    not need or want to know the details of the source code.
    
    The CASTOR_DLF_WRITEPC macro macro generates the file, line and function
    context information automatically and passes it on down the DLF logging chain.
    This means developers do not need to use the __FILE__, __LINE__,
    __PRETTY_FUNCTION__ macros in their application code when logging.  Here is an
    example of using this macro:
    
      try {
        ...
      } catch(castor::exception::Exception &ex) {
        castor::dlf::Param params[] = {
          castor::dlf::Param("volReqId", vdqmJobRequest.tapeRequestId),
          castor::dlf::Param("Message" , ex.getMessage().str()       ),
          castor::dlf::Param("Code"    , ex.code()                   )};
        CASTOR_DLF_WRITEPC(cuuid, DLF_LVL_ERROR, AGGREGATOR_MAIN_SELECT_FAILED,
          params);
      }
    b63bb04d