本文整理汇总了C++中LogManager类的典型用法代码示例。如果您正苦于以下问题:C++ LogManager类的具体用法?C++ LogManager怎么用?C++ LogManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printPhotonMap
void PhotonGrid::printPhotonMap(const char *LoggerName) {
LogManager *log = LogManager::getSingletonPtr();
char outputBuffer[2000];
log->logMessage("-------------------------------------------", LoggerName);
log->logMessage("Photon Grid Statistics", LoggerName);
log->logMessage("-------------------------------------------", LoggerName);
//sprintf(outputBuffer, "Time to build:\t%d seconds, %d milliseconds", (int)timeBuild, (int)((timeBuild - floor(timeBuild)) * 1000));
//log->logMessage(outputBuffer, LoggerName);
sprintf(outputBuffer, "Photons requested:\t%d", m_nPhotons + m_nPhotonsMissed);
log->logMessage(outputBuffer, LoggerName);
sprintf(outputBuffer, "Photons in map:\t%d", m_nPhotons );
log->logMessage(outputBuffer, LoggerName);
sprintf(outputBuffer, "Photons missed:\t%d", m_nPhotonsMissed);
log->logMessage(outputBuffer, LoggerName);
sprintf(outputBuffer, "Grid dimensions:\t%d x %d x %d Voxels, %.3f x %.3f x %.3f per Voxel",
gridDimension[0], gridDimension[1], gridDimension[2],
gridDelta[0], gridDelta[1], gridDelta[2]);
log->logMessage(outputBuffer, LoggerName);
#ifndef _GRID_HASH
sprintf(outputBuffer, "Memory usage:\tGrid: %d KB\tMask: %d KB",
int(gridDimension[0] * gridDimension[1] * gridDimension[2] * sizeof(GridPhoton)) / 1024,
m_nGridBlocks / (8 * 1024));
log->logMessage(outputBuffer, LoggerName);
#else
m_pGrid.printStats(LoggerName);
#endif
sprintf(outputBuffer, "Blocks:\t%d / %d blocks used", m_nGridBlocksUsed, m_nGridBlocks);
log->logMessage(outputBuffer, LoggerName);
}
示例2: updateScene
void GLscene::updateScene()
{
if (m_log->index()<0) return;
#ifdef USE_COLLISION_STATE
LogManager<OpenHRP::CollisionDetectorService::CollisionState> *lm
= (LogManager<OpenHRP::CollisionDetectorService::CollisionState> *)m_log;
GLbody *glbody = dynamic_cast<GLbody *>(body(0).get());
OpenHRP::CollisionDetectorService::CollisionState &co = lm->state();
if (co.angle.length() == glbody->numJoints()){
for (int i=0; i<glbody->numJoints(); i++){
GLlink *j = (GLlink *)glbody->joint(i);
if (j){
j->setQ(co.angle[i]);
}
}
}
#else
LogManager<TimedPosture> *lm
= (LogManager<TimedPosture> *)m_log;
GLbody *glbody = dynamic_cast<GLbody *>(body(0).get());
TimedPosture &ts = lm->state();
if (ts.posture.size() == glbody->numJoints()){
for (int i=0; i<glbody->numJoints(); i++){
GLlink *j = (GLlink *)glbody->joint(i);
if (j){
j->setQ(ts.posture[i]);
}
}
}
#endif
}
示例3: LogManager
void PageCoreTests::setUp()
{
// set up silent logging to not pollute output
if(LogManager::getSingletonPtr())
OGRE_DELETE Ogre::LogManager::getSingletonPtr();
if(LogManager::getSingletonPtr() == 0)
{
LogManager* logManager = OGRE_NEW LogManager();
logManager->createLog("testPageCore.log", true, false);
}
LogManager::getSingleton().setLogDetail(LL_LOW);
#if OGRE_STATIC
mStaticPluginLoader = OGRE_NEW StaticPluginLoader();
#endif
#ifdef OGRE_STATIC_LIB
mRoot = OGRE_NEW Root(StringUtil::BLANK);
mStaticPluginLoader.load();
#else
mRoot = OGRE_NEW Root();
#endif
LogManager::getSingleton().setLogDetail(LL_LOW);
mPageManager = OGRE_NEW PageManager();
// make certain the resource location is NOT read-only
ResourceGroupManager::getSingleton().addResourceLocation("./", "FileSystem",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, false);
mSceneMgr = mRoot->createSceneManager(ST_GENERIC);
}
示例4: updateScene
void GLscene::updateScene()
{
if (m_log->index()<0) return;
LogManager<OpenHRP::WorldState> *lm
= (LogManager<OpenHRP::WorldState> *)m_log;
OpenHRP::WorldState &state = lm->state();
for (unsigned int i=0; i<state.characterPositions.length(); i++){
const CharacterPosition& cpos = state.characterPositions[i];
std::string cname(cpos.characterName);
GLbody *glbody = dynamic_cast<GLbody *>(body(cname).get());
if (!glbody) {
//std::cerr << "can't find a body named " << cname << std::endl;
continue;
}
for (unsigned int j=0; j<cpos.linkPositions.length(); j++){
const LinkPosition &lp = cpos.linkPositions[j];
double T[] = {lp.R[0], lp.R[3], lp.R[6],0,
lp.R[1], lp.R[4], lp.R[7],0,
lp.R[2], lp.R[5], lp.R[8],0,
lp.p[0], lp.p[1], lp.p[2],1};
#if 0
for (int i=0; i<4; i++){
for (int j=0; j<4; j++){
printf("%6.3f ", T[i*4+j]);
}
printf("\n");
}
printf("\n");
#endif
((GLlink *)glbody->link(j))->setAbsTransform(T);
}
}
}
示例5: main
int main(int argc, char *argv[]) {
LogManager logManager;
if (!logManager.init()) {
std::cerr << "Logger init failed! Exiting.." << std::endl;
exit(EXIT_FAILURE);
}
//TODO: use sigaction for portability
signal(SIGPIPE, SIG_IGN);
if (argc == 1) {
usage();
} else if ( argc >= 2 &&
(!strncmp(argv[1], "-v", strlen("-v")) || !strncmp(argv[1], "--version", strlen("--version"))) ) {
LOG(INFO) << "Version: " << RTT_TRACER_VERSION << std::endl;
exit(EXIT_SUCCESS);
}
LOG(INFO) << "RTT Tracer version " << RTT_TRACER_VERSION << " starting.." << std::endl;
if (argc == 3 && !strncmp(argv[1], "-s", strlen("-s"))) {
RttTcpServer server(atoi(argv[2]));
server.start();
} else if (argc == 4 && !strncmp(argv[1], "-c", strlen("-c"))) {
RttTcpClient client(std::string(argv[2]), atoi(argv[3]));
client.start();
} else {
usage();
}
}
示例6: Open
bool ProjectTemplateLoader::Open(const wxString& filename)
{
LogManager* pMsg = Manager::Get()->GetLogManager();
if (!pMsg)
return false;
// pMsg->DebugLog(_T("Reading template file %s"), filename.c_str());
TiXmlDocument doc(filename.mb_str());
if (!doc.LoadFile())
return false;
TiXmlElement* root;
root = doc.FirstChildElement("CodeBlocks_template_file");
if (!root)
{
// old tag
root = doc.FirstChildElement("Em::Blocks_template_file");
if (!root)
{
pMsg->DebugLog(_T("Not a valid Em::Blocks template file..."));
return false;
}
}
DoTemplate(root);
return true;
}
示例7: if
bool MSVC10Loader::DoCreateConfigurations()
{
LogManager* pMsg = Manager::Get()->GetLogManager();
if (!pMsg) return false;
bool bResult = false;
// create the project targets
for (HashProjectsConfs::iterator it = m_pc.begin(); it != m_pc.end(); ++it)
{
ProjectBuildTarget* bt = m_pProject->AddBuildTarget(it->second.sName);
if (bt)
{
bt->SetCompilerID(m_pProject->GetCompilerID());
bt->AddPlatform(spAll); // target all platforms, SupportedPlatforms enum in "globals.h"
TargetType tt = ttExecutable;
if (it->second.TargetType == _T("Application")) tt = ttExecutable;
else if (it->second.TargetType == _T("Console")) tt = ttConsoleOnly;
else if (it->second.TargetType == _T("StaticLibrary")) tt = ttStaticLib;
else if (it->second.TargetType == _T("DynamicLibrary")) tt = ttDynamicLib;
else
pMsg->DebugLog(_("Import; Unsupported target type: ") + it->second.TargetType);
bt->SetTargetType(tt); // executable by default, TargetType enum in "globals.h"
it->second.bt = bt; // apply
pMsg->DebugLog(_("Created project build target: ") + it->second.sName);
bResult = true; // at least one config imported
}
}
return bResult;
}
示例8: OnDisableAll
UI::EventReturn LogConfigScreen::OnDisableAll(UI::EventParams &e) {
LogManager *logMan = LogManager::GetInstance();
for (int i = 0; i < LogManager::GetNumChannels(); i++) {
LogChannel *chan = logMan->GetLogChannel((LogTypes::LOG_TYPE)i);
chan->enabled = false;
}
return UI::EVENT_DONE;
}
示例9: sprintf
void GLscene::showStatus()
{
char buf[256];
GLbody *glbody = dynamic_cast<GLbody *>(body(0).get());
int width = m_width - 220;
#define HEIGHT_STEP 12
int height = m_height-HEIGHT_STEP;
int x = width;
for (int i=0; i<glbody->numLinks(); i++){
hrp::Link *l = glbody->link(i);
if (l){
sprintf(buf, "%13s %4d tris",
l->name.c_str(),
l->coldetModel->getNumTriangles());
glRasterPos2f(x, height);
drawString(buf);
height -= HEIGHT_STEP;
}
}
if (m_log->index()<0) return;
LogManager<OpenHRP::CollisionDetectorService::CollisionState> *lm
= (LogManager<OpenHRP::CollisionDetectorService::CollisionState> *)m_log;
OpenHRP::CollisionDetectorService::CollisionState &co = lm->state();
height -= HEIGHT_STEP;
x = width - 34;
sprintf(buf, "Number of pair %8d", co.lines.length());
glRasterPos2f(x, height);
drawString(buf);
height -= HEIGHT_STEP;
sprintf(buf, "Calc Time [msec] %8.3f", co.computation_time);
glRasterPos2f(x, height);
drawString(buf);
height -= HEIGHT_STEP;
sprintf(buf, "Recover Time[msec] %8.3f", co.recover_time);
glRasterPos2f(x, height);
drawString(buf);
height -= HEIGHT_STEP;
sprintf(buf, "Safe Posture %8s", co.safe_posture?"true":"false");
glRasterPos2f(x, height);
drawString(buf);
height -= HEIGHT_STEP;
sprintf(buf, "Loop for check %8d", co.loop_for_check);
glRasterPos2f(x, height);
drawString(buf);
height -= HEIGHT_STEP;
}
示例10: LogManager
void TerrainTests::setUp()
{
// set up silent logging to not pollute output
if(LogManager::getSingletonPtr())
OGRE_DELETE Ogre::LogManager::getSingletonPtr();
if(LogManager::getSingletonPtr() == 0)
{
LogManager* logManager = OGRE_NEW LogManager();
logManager->createLog("testTerrain.log", true, false);
}
LogManager::getSingleton().setLogDetail(LL_LOW);
mFSLayer = OGRE_NEW_T(Ogre::FileSystemLayer, Ogre::MEMCATEGORY_GENERAL)(OGRE_VERSION_NAME);
#ifdef OGRE_STATIC_LIB
mRoot = OGRE_NEW Root(BLANKSTRING);
mStaticPluginLoader.load();
#else
String pluginsPath = mFSLayer->getConfigFilePath("plugins.cfg");
mRoot = OGRE_NEW Root(pluginsPath);
#endif
mTerrainOpts = OGRE_NEW TerrainGlobalOptions();
// Load resource paths from config file
ConfigFile cf;
String resourcesPath;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
resourcesPath = mFSLayer->getConfigFilePath("resources.cfg");
#else
resourcesPath = mFSLayer->getConfigFilePath("bin/resources.cfg");
#endif
cf.load(resourcesPath);
// Go through all sections & settings in the file
ConfigFile::SectionIterator seci = cf.getSectionIterator();
String secName, typeName, archName;
while (seci.hasMoreElements())
{
secName = seci.peekNextKey();
ConfigFile::SettingsMultiMap *settings = seci.getNext();
ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}
mSceneMgr = mRoot->createSceneManager(ST_GENERIC);
}
示例11: ToDoListView
void ToDoList::OnAttach()
{
// create ToDo in bottom view
wxArrayString titles;
wxArrayInt widths;
titles.Add(_("Type")); widths.Add(64);
titles.Add(_("Text")); widths.Add(320);
titles.Add(_("User")); widths.Add(64);
titles.Add(_("Prio")); widths.Add(48);
titles.Add(_("Line")); widths.Add(48);
titles.Add(_("Date")); widths.Add(56);
titles.Add(_("File")); widths.Add(640);
m_pListLog = new ToDoListView(titles, widths, m_Types);
m_StandAlone = Manager::Get()->GetConfigManager(_T("todo_list"))->ReadBool(_T("stand_alone"), true);
if (!m_StandAlone)
{
LogManager* msgMan = Manager::Get()->GetLogManager();
m_ListPageIndex = msgMan->SetLog(m_pListLog);
msgMan->Slot(m_ListPageIndex).title = _("To Do");
CodeBlocksLogEvent evt(cbEVT_ADD_LOG_WINDOW, m_pListLog, msgMan->Slot(m_ListPageIndex).title, msgMan->Slot(m_ListPageIndex).icon);
Manager::Get()->ProcessEvent(evt);
}
else
{
m_pListLog->CreateControl(Manager::Get()->GetAppWindow());
m_pListLog->GetWindow()->SetSize(wxSize(352,94));
m_pListLog->GetWindow()->SetInitialSize(wxSize(352,94));
CodeBlocksDockEvent evt(cbEVT_ADD_DOCK_WINDOW);
evt.name = _T("TodoListPanev2.0.0");
evt.title = _("Todo list");
evt.pWindow = m_pListLog->GetWindow();
evt.dockSide = CodeBlocksDockEvent::dsFloating;
evt.desiredSize.Set(352, 94);
evt.floatingSize.Set(352, 94);
evt.minimumSize.Set(352, 94);
Manager::Get()->ProcessEvent(evt);
}
m_AutoRefresh = Manager::Get()->GetConfigManager(_T("todo_list"))->ReadBool(_T("auto_refresh"), true);
LoadUsers();
LoadTypes();
// register event sink
Manager::Get()->RegisterEventSink(cbEVT_APP_STARTUP_DONE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnAppDoneStartup));
Manager::Get()->RegisterEventSink(cbEVT_EDITOR_OPEN, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparseCurrent));
Manager::Get()->RegisterEventSink(cbEVT_EDITOR_SAVE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparseCurrent));
Manager::Get()->RegisterEventSink(cbEVT_EDITOR_ACTIVATED, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparseCurrent));
Manager::Get()->RegisterEventSink(cbEVT_EDITOR_CLOSE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparseCurrent));
Manager::Get()->RegisterEventSink(cbEVT_PROJECT_CLOSE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparse));
Manager::Get()->RegisterEventSink(cbEVT_PROJECT_ACTIVATE, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparse));
Manager::Get()->RegisterEventSink(cbEVT_PROJECT_FILE_ADDED, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparse));
Manager::Get()->RegisterEventSink(cbEVT_PROJECT_FILE_REMOVED, new cbEventFunctor<ToDoList, CodeBlocksEvent>(this, &ToDoList::OnReparse));
}
示例12: setConfig
///<summary>Initialisation du client</summary>
///<param name="configPath">Chemin d'accès du fichier de configuration</param>
///<exception cref="MessageException">Echec d'initialisation</exception>
void ContainerApp::init(const std::string configPath)
{
// récupérer configuration du serveur
setConfig(configPath);
// démarrer utilitaire de log
LogManager* logTool = LogManager::getInstance(); // exception
logTool->setFilePath(LOG_FILEPATH);
logTool->setSeparator(_pConfig->logCsvSeparator);
}
示例13: Stop
/*!
\brief Destructor. Stop process if already running, destroy log windows.
*/
OpenOCDDriver::~OpenOCDDriver()
{
if (m_bStarted)
Stop();
if (!(m_pLog == NULL)) {
LogManager* msgMan = Manager::Get()->GetLogManager();
CodeBlocksLogEvent evtAdd(cbEVT_REMOVE_LOG_WINDOW, m_pLog, msgMan->Slot(m_PageIndex).title, msgMan->Slot(m_PageIndex).icon);
Manager::Get()->ProcessEvent(evtAdd);
}
}
示例14: close
void Network::close(void)//const String& anIp, const int aPort)
{
LogManager *logger = Ogre::LogManager::getSingletonPtr();
// Closing a socket.
if (m_socket != NULL)
{
//closesocket(m_socket);
m_socket = NULL;
}
logger->logMessage("Socket closed.\n");
}
示例15: OnToggleAll
UI::EventReturn LogConfigScreen::OnToggleAll(UI::EventParams &e) {
LogManager *logMan = LogManager::GetInstance();
for (int i = 0; i < LogManager::GetNumChannels(); i++) {
LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i;
LogChannel *chan = logMan->GetLogChannel(type);
chan->enable_ = !chan->enable_;
}
return UI::EVENT_DONE;
}