source: trunk/packages/vizservers/geovis/Trace.h @ 4422

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

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

File size: 1.1 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 GEOVIS_TRACE_H
9#define GEOVIS_TRACE_H
10
11#include <string>
12
13#include <syslog.h>
14
15namespace GeoVis {
16
17extern void logUserMessage(const char* format, ...);
18
19extern std::string getUserMessages();
20
21extern void clearUserMessages();
22
23extern void initLog();
24
25extern void closeLog();
26
27extern void logMessage(int priority, const char *funcname, const char *fileName,
28                       int lineNum, const char* format, ...);
29
30#define ERROR(...)      GeoVis::logMessage(LOG_ERR, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
31#ifdef WANT_TRACE
32#define TRACE(...)      GeoVis::logMessage(LOG_DEBUG, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
33#else
34#define TRACE(...)
35#endif  /*WANT_TRACE*/
36#define WARN(...)       GeoVis::logMessage(LOG_WARNING, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
37#define INFO(...)       GeoVis::logMessage(LOG_INFO, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
38
39#define USER_ERROR(...) GeoVis::logUserMessage(__VA_ARGS__)
40
41}
42
43#endif
Note: See TracBrowser for help on using the repository browser.