source: nanovis/trunk/Trace.h @ 4596

Last change on this file since 4596 was 4422, checked in by ldelgass, 10 years ago

Fix crash bug in user errors: was returning pointer to temporary. Return a
copy of string object from getUserMessages instead of pointer.

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2004-2013  HUBzero Foundation, LLC
4 *
5 * Author: George A. Howlett <gah@purdue.edu>
6 */
7
8#ifndef NV_TRACE_H
9#define NV_TRACE_H
10
11#include <string>
12
13#include <GL/glew.h>
14#include <syslog.h>
15
16#include "config.h"
17
18#define MAKE_STRING(x) #x
19#define NEWSTRING(x) MAKE_STRING(x)
20#define AT __FILE__ ":" NEWSTRING(__LINE__)
21
22namespace nv {
23
24extern void logUserMessage(const char* format, ...);
25
26extern std::string getUserMessages();
27
28extern void clearUserMessages();
29
30extern void initLog();
31
32extern void closeLog();
33
34extern void LogMessage(int priority, const char *funcname, const char *fileName,
35                       int lineNum, const char* format, ...);
36
37#define ERROR(...)      nv::LogMessage(LOG_ERR, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
38#ifdef WANT_TRACE
39#define TRACE(...)      nv::LogMessage(LOG_DEBUG, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
40#else
41#define TRACE(...)
42#endif
43#define WARN(...)       nv::LogMessage(LOG_WARNING, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
44#define INFO(...)       nv::LogMessage(LOG_INFO, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
45
46#define USER_ERROR(...) nv::logUserMessage(__VA_ARGS__)
47
48}
49
50extern bool CheckFBO(GLenum *status);
51extern void PrintFBOStatus(GLenum status, const char *prefix);
52extern bool CheckGL(const char *prefix);
53
54#endif
Note: See TracBrowser for help on using the repository browser.