aboutsummaryrefslogtreecommitdiffstats
path: root/vespalog/src/vespa/log/log-assert.cpp
blob: 4b6469d4527860bf5296964444b129f4627c7c69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "log.h"
#include <cstdio>
LOG_SETUP("");

namespace ns_log {

void log_assert_fail(const char *assertion,
                     const char *file,
                     uint32_t line)
{
    LOG(error, "%s:%d: Failed assertion: '%s'",
        file, line, assertion);
    fprintf(stderr, "%s:%d: Failed assertion: '%s'\n",
            file, line, assertion);
    abort();
}


void log_abort(const char *message,
               const char *file,
               unsigned int line)
{
    LOG(error, "%s:%d: Abort called. Reason: %s",
        file, line, message);
    fprintf(stderr, "%s:%d: Abort called. Reason: %s\n",
            file, line, message);
    abort();
}

} // end namespace ns_log