Created
October 15, 2011 04:14
-
-
Save taxilian/1289031 to your computer and use it in GitHub Desktop.
Example of adding a file-based logging method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/filesystem.hpp> | |
#include "SystemHelpers.h" | |
using namespace boost::filesystem; | |
/// ... | |
void getLoggingMethods( FB::Log::LogMethodList& outMethods ) | |
{ | |
path appDataPath = FB::System::getLocalAppDataPath("CompanyName"); | |
path logDirPath = appDataPath / "logs"; | |
if (exists(logDirPath) && is_directory(logDirPath)) { | |
std::stringstream ss; | |
time_t seconds = time(NULL); | |
boost::thread::id threadId = boost::this_thread::get_id(); | |
ss << seconds << "_" << threadId << ".log"; | |
path logPath = logDirPath / ss.str(); | |
fprintf(stderr, "logging to %s", logPath.string().c_str()); | |
outMethods.push_back(std::make_pair(FB::Log::LogMethod_File, logPath.string())); | |
} | |
#ifndef NDEBUG | |
outMethods.push_back(std::make_pair(FB::Log::LogMethod_Console, std::string())); | |
#endif | |
} | |
// ... |
got it, the reason was *.so has not be update.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how about linux ?