Ignore:
Timestamp:
Apr 2, 2013, 1:31:30 PM (12 years ago)
Author:
ldelgass
Message:

Add writer thread to nanovis (set USE_THREADS in Makefile), more refactoring.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/Trace.cpp

    r3597 r3605  
    1010#include <string.h>
    1111
     12#include <string>
     13#include <sstream>
     14
    1215#include <GL/glew.h>
    1316
     
    1518#include "Trace.h"
    1619
     20using namespace nv;
     21
     22static std::ostringstream g_UserErrorString;
     23
    1724#define MSG_LEN 2047
    1825
     26/**
     27 * \brief Open syslog for writing
     28 */
     29void
     30nv::initLog()
     31{
     32    openlog("nanovis", LOG_CONS | LOG_PERROR | LOG_PID,  LOG_USER);
     33}
     34
     35/**
     36 * \brief Close syslog
     37 */
     38void
     39nv::closeLog()
     40{
     41    closelog();
     42}
     43
     44/**
     45 * \brief Write a message to syslog
     46 */
    1947void
    20 LogMessage(int priority, const char *funcname,
    21            const char *path, int lineNum, const char* fmt, ...)
     48nv::LogMessage(int priority, const char *funcname,
     49               const char *path, int lineNum, const char* fmt, ...)
    2250{
    2351    char message[MSG_LEN+1];
     
    4270
    4371    syslog(priority, "%s", message);
     72}
     73
     74/**
     75 * \brief Write a user message to buffer
     76 */
     77void
     78nv::logUserMessage(const char* fmt, ...)
     79{
     80    char message[MSG_LEN + 1];
     81    int length = 0;
     82    va_list lst;
     83
     84    va_start(lst, fmt);
     85
     86    length += vsnprintf(message, MSG_LEN, fmt, lst);
     87    message[MSG_LEN] = '\0';
     88
     89    g_UserErrorString << message << "\n";
     90}
     91
     92const char *
     93nv::getUserMessages()
     94{
     95    return g_UserErrorString.str().c_str();
     96}
     97
     98void
     99nv::clearUserMessages()
     100{
     101    g_UserErrorString.str(std::string());
    44102}
    45103
     
    116174    return false;
    117175}
    118 
    119 
Note: See TracChangeset for help on using the changeset viewer.