1
0
Fork 0

include/Spectre/System/Log.h: implement a static "Log" class instead of just a function.

This commit is contained in:
Henrik Hautakoski 2019-11-10 14:56:56 +01:00
parent e10daeaaa6
commit 3b27db9435
No known key found for this signature in database
GPG key ID: 96765B12FEAC4745
8 changed files with 101 additions and 31 deletions

View file

@ -37,14 +37,14 @@ bool ImageLoader::loadFromFile(const char *filename, Image& img)
// loaded into memory. now decode.
if (decode((const char*)&buf[0], buf.size(), img) == false) {
log("ImageLoader: could not load file '%s'. Reason: %s",
Log::warn("ImageLoader: could not load file '%s'. Reason: %s",
filename, m_error);
return false;
}
return true;
}
log("ImageLoader: could not open file '%s'. Reason: %s",
Log::warn("ImageLoader: could not open file '%s'. Reason: %s",
filename, strerror(errno));
return false;
}
@ -67,12 +67,12 @@ bool ImageLoader::saveToFile(const Image& img, const char *filename)
if (ext == "png") {
if (!encodePNG(img, encoded_data)) {
log("ImageLoader: failed to save file '%s'. Reason: \n",
Log::warn("ImageLoader: failed to save file '%s'. Reason: %s",
filename, m_error);
}
} else {
log("ImageLoader: Invalid file format\n");
Log::warn("ImageLoader: Invalid file format");
return false;
}