示例#1
0
PANTHEIOS_CALL(int) pantheios_be_logEntry(
    void*               feToken
,   void*               beToken
,   int                 severity
,   PAN_CHAR_T const*   entry
,   size_t              cchEntry
)
{
    pan_lr_tokens_t* tokens = (pan_lr_tokens_t*)beToken;
    int             r1;
    int             r2;

    /* Pre-condition testing. */
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API(NULL != tokens, "back-end token pointer may not be null");

    r1 = pantheios_fe_isSeverityLogged(feToken, severity, PANTHEIOS_BEID_LOCAL)
            ? pantheios_be_local_logEntry(feToken, tokens->localToken, severity, entry, cchEntry)
            : 0;
    r2 = pantheios_fe_isSeverityLogged(feToken, severity, PANTHEIOS_BEID_REMOTE)
            ? pantheios_be_remote_logEntry(feToken, tokens->remoteToken, severity, entry, cchEntry)
            : 0;

    /* Remote is given priority in failure stakes. It's probably of little significance,
     * but a choice was demanded.
     */
    if(r2 < 0)
    {
        return r2;
    }
    else if(r1 < 0)
    {
        return r1;
    }
    else
    {
        return r2;
    }
}
示例#2
0
pantheios_be_logEntry(
    void*               feToken
,   void*               beToken
,   int                 severity
,   PAN_CHAR_T const*   entry
,   size_t              cchEntry
)
{
    int         res         =   0;
    pan_be_N_t* backEnd;
    int const   severity4   =   severity & 0x0f;
    int const   custom28    =   (severity >> 4) & 0x0fffffff;

    STLSOFT_SUPPRESS_UNUSED(beToken);

    for(backEnd = &PAN_BE_N_BACKEND_LIST[0]; NULL != backEnd->pfnInit; ++backEnd)
    {
        if(PANTHEIOS_BE_N_F_IGNORE_INIT_FAILURE & backEnd->flags)
        {
            /* Was not initialised. */
        }
        else if(severity4 < backEnd->severityFloor)
        {
            /* Statically filtered out */
        }
        else if(severity4 > backEnd->severityCeiling)
        {
            /* Statically filtered out */
        }
        else
        {
/*
            custom28        must-match      ignore non-match

              0               skip              ok
              == id           ok                ok
              != id           skip              skip
*/

            if(custom28 != backEnd->backEndId)
            {
                /* If the custom28 does not match the back-end's id, we need to
                 * see if the back-end has special instructions.
                 */

                /* Test for PANTHEIOS_BE_N_F_ID_MUST_MATCH_CUSTOM28: skip mismatch'd output if specified. */
                if(PANTHEIOS_BE_N_F_ID_MUST_MATCH_CUSTOM28 & backEnd->flags)
                {
                    continue;
                }

                /* Test for PANTHEIOS_BE_N_F_IGNORE_NONMATCHED_CUSTOM28_ID: skip if mismatched, and custom != 0 */
                if( PANTHEIOS_BE_N_F_IGNORE_NONMATCHED_CUSTOM28_ID == (PANTHEIOS_BE_N_F_IGNORE_NONMATCHED_CUSTOM28_ID & backEnd->flags) &&
                    0 != custom28)
                {
                    continue;
                }
            }

            if(pantheios_fe_isSeverityLogged(feToken, severity, backEnd->backEndId))
            {
                int r2 = (*backEnd->pfnLogEntry)(feToken, backEnd->token, severity, entry, cchEntry);

                if(0 != r2)
                {
                    res = r2;
                }
            }
        }
    }

    return res;
}