Commit bdc568b8 authored by Kenton Varda's avatar Kenton Varda

Tweak previous change.

parent 93e030e3
......@@ -60,6 +60,12 @@ public:
Exception(const Exception& other) noexcept;
~Exception() noexcept;
const char* getFile() const { return file; }
int getLine() const { return line; }
Nature getNature() const { return nature; }
Durability getDurability() const { return durability; }
ArrayPtr<const char> getDescription() const { return description; }
const char* what() const noexcept override;
private:
......
......@@ -126,7 +126,7 @@ static Array<char> makeDescription(const char* condition, const char* macroArgs,
}
}
void Log::logInternal(const char* file, uint line, Severity severity, const char* macroArgs,
void Log::logInternal(const char* file, int line, Severity severity, const char* macroArgs,
ArrayPtr<Array<char>> argValues) {
getExceptionCallback()->logMessage(
str(severity, ": ", file, ":", line, ": ",
......@@ -134,7 +134,7 @@ void Log::logInternal(const char* file, uint line, Severity severity, const char
}
void Log::recoverableFaultInternal(
const char* file, uint line, Exception::Nature nature,
const char* file, int line, Exception::Nature nature,
const char* condition, const char* macroArgs, ArrayPtr<Array<char>> argValues) {
getExceptionCallback()->onRecoverableException(
Exception(nature, Exception::Durability::PERMANENT, file, line,
......@@ -142,7 +142,7 @@ void Log::recoverableFaultInternal(
}
void Log::fatalFaultInternal(
const char* file, uint line, Exception::Nature nature,
const char* file, int line, Exception::Nature nature,
const char* condition, const char* macroArgs, ArrayPtr<Array<char>> argValues) {
getExceptionCallback()->onFatalException(
Exception(nature, Exception::Durability::PERMANENT, file, line,
......
......@@ -48,28 +48,28 @@ public:
static inline void setLogLevel(Severity severity) { minSeverity = severity; }
template <typename... Params>
static void log(const char* file, uint line, Severity severity, const char* macroArgs,
static void log(const char* file, int line, Severity severity, const char* macroArgs,
Params&&... params);
template <typename... Params>
static void recoverableFault(const char* file, uint line, Exception::Nature nature,
static void recoverableFault(const char* file, int line, Exception::Nature nature,
const char* condition, const char* macroArgs, Params&&... params);
template <typename... Params>
static void fatalFault(const char* file, uint line, Exception::Nature nature,
static void fatalFault(const char* file, int line, Exception::Nature nature,
const char* condition, const char* macroArgs, Params&&... params)
CAPNPROTO_NORETURN;
private:
static Severity minSeverity;
static void logInternal(const char* file, uint line, Severity severity, const char* macroArgs,
static void logInternal(const char* file, int line, Severity severity, const char* macroArgs,
ArrayPtr<Array<char>> argValues);
static void recoverableFaultInternal(
const char* file, uint line, Exception::Nature nature,
const char* file, int line, Exception::Nature nature,
const char* condition, const char* macroArgs, ArrayPtr<Array<char>> argValues);
static void fatalFaultInternal(
const char* file, uint line, Exception::Nature nature,
const char* file, int line, Exception::Nature nature,
const char* condition, const char* macroArgs, ArrayPtr<Array<char>> argValues)
CAPNPROTO_NORETURN;
};
......@@ -113,14 +113,14 @@ ArrayPtr<const char> operator*(const Stringifier&, Log::Severity severity);
#endif
template <typename... Params>
void Log::log(const char* file, uint line, Severity severity, const char* macroArgs,
void Log::log(const char* file, int line, Severity severity, const char* macroArgs,
Params&&... params) {
Array<char> argValues[sizeof...(Params)] = {str(params)...};
logInternal(file, line, severity, macroArgs, arrayPtr(argValues, sizeof...(Params)));
}
template <typename... Params>
void Log::recoverableFault(const char* file, uint line, Exception::Nature nature,
void Log::recoverableFault(const char* file, int line, Exception::Nature nature,
const char* condition, const char* macroArgs, Params&&... params) {
Array<char> argValues[sizeof...(Params)] = {str(params)...};
recoverableFaultInternal(file, line, nature, condition, macroArgs,
......@@ -128,7 +128,7 @@ void Log::recoverableFault(const char* file, uint line, Exception::Nature nature
}
template <typename... Params>
void Log::fatalFault(const char* file, uint line, Exception::Nature nature,
void Log::fatalFault(const char* file, int line, Exception::Nature nature,
const char* condition, const char* macroArgs, Params&&... params) {
Array<char> argValues[sizeof...(Params)] = {str(params)...};
fatalFaultInternal(file, line, nature, condition, macroArgs,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment