示例#1
0
char *PromiseLoggingPromiseFinish(const EvalContext *eval_context, const Promise *pp)
{
    LoggingPrivContext *pctx = LoggingPrivGetContext();

    if (pctx == NULL)
    {
        ProgrammingError("Promise logging: Unable to finish promise, not bound to EvalContext");
    }

    PromiseLoggingContext *plctx = pctx->param;

    if (plctx->eval_context != eval_context)
    {
        ProgrammingError("Promise logging: Unable to finish promise, bound to EvalContext different from passed one");
    }

    if (EvalContextStackGetTopPromise(eval_context) != pp)
    {
        /*
         * FIXME: There are still cases where promise passed here is not on top of stack
         */
        /* ProgrammingError("Logging: Attempt to finish promise not on top of stack"); */
    }

    char *last_message = plctx->last_message;

    plctx->promise_level--;
    plctx->last_message = NULL;
    free(plctx->stack_path);

    LoggingPrivSetLevels(LogGetGlobalLevel(), LogGetGlobalLevel());

    return last_message;
}
示例#2
0
void PromiseLoggingPromiseEnter(const EvalContext *eval_context, const Promise *pp)
{
    LoggingPrivContext *pctx = LoggingPrivGetContext();

    if (pctx == NULL)
    {
        ProgrammingError("Promise logging: Unable to enter promise, not bound to EvalContext");
    }

    PromiseLoggingContext *plctx = pctx->param;

    if (plctx->eval_context != eval_context)
    {
        ProgrammingError("Promise logging: Unable to enter promise, bound to EvalContext different from passed one");
    }

    if (EvalContextStackGetTopPromise(eval_context) != pp)
    {
        /*
         * FIXME: There are still cases where promise passed here is not on top of stack
         */
        /* ProgrammingError("Logging: Attempt to set promise not on top of stack as current"); */
    }

    plctx->promise_level++;
    plctx->stack_path = EvalContextStackPath(eval_context);

    LoggingPrivSetLevels(CalculateLogLevel(eval_context, pp), CalculateReportLevel(eval_context, pp));
}
示例#3
0
void LogSetGlobalLevel(LogLevel level)
{
    LoggingContext *lctx = GetCurrentThreadContext();
    lctx->global_level = level;
    LoggingPrivSetLevels(level, level);
}
示例#4
0
void LogSetGlobalLevel(LogLevel level)
{
    global_level = level;
    LoggingPrivSetLevels(level, level);
}