summaryrefslogtreecommitdiffstats
path: root/vespalog/src/vespa/log/internal.h
blob: c25c7cc44b62fe83b84aabd276f220e31d7ef314 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <string>
#include <cstdlib>

namespace ns_log {

[[noreturn]] void throwInvalid(const char *fmt, ...) __attribute__((format(printf, 1, 2)));

class InvalidLogException {
private:
    std::string _what;

public:
    InvalidLogException& operator = (const InvalidLogException&) = delete;
    InvalidLogException(const InvalidLogException &x) = default;
    explicit InvalidLogException(const char *s) : _what(s) {}
    ~InvalidLogException() = default;
    [[nodiscard]] const char *what() const { return _what.c_str(); }
};

} // end namespace ns_log