source: trunk/packages/vizservers/vtkvis/Trace.cpp @ 2507

Last change on this file since 2507 was 2506, checked in by ldelgass, 13 years ago

Add option to send VTK file to be used for streamlines seeds. The seeds can
come from the mesh points or from filling the mesh cells with randomly
placed points. The VTK data file can be any type of dataset that has points
and cells (cells only required if using random placement within cells). Also
add option to use points of main dataset mesh.

  • 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) 2011, Purdue Research Foundation
4 *
5 * Author: George A. Howlett <gah@purdue.edu>
6 */
7
8#include <cstdio>
9#include <cstdarg>
10#include <cstring>
11#include <syslog.h>
12
13#include "Trace.h"
14
15using namespace Rappture::VtkVis;
16
17#define MSG_LEN 2047
18
19/**
20 * \brief Open syslog for writing
21 */
22void
23Rappture::VtkVis::InitLog()
24{
25    openlog("vtkvis", LOG_CONS | LOG_PERROR | LOG_PID,  LOG_USER);
26}
27
28/**
29 * \brief Close syslog
30 */
31void
32Rappture::VtkVis::CloseLog()
33{
34    closelog();
35}
36
37/**
38 * \brief Write a message to syslog
39 */
40void
41Rappture::VtkVis::LogMessage(int priority, const char *funcname,
42                             const char *path, int lineNum, const char* fmt, ...)
43{
44    char message[MSG_LEN + 1];
45    const char *s;
46    int length;
47    va_list lst;
48
49    va_start(lst, fmt);
50    s = strrchr(path, '/');
51    if (s == NULL) {
52        s = path;
53    } else {
54        s++;
55    }
56    if (priority & LOG_DEBUG) {
57        length = snprintf(message, MSG_LEN, "%s:%d(%s): ", s, lineNum, funcname);
58    } else {
59        length = snprintf(message, MSG_LEN, "%s:%d: ", s, lineNum);
60    }
61    length += vsnprintf(message + length, MSG_LEN - length, fmt, lst);
62    message[MSG_LEN] = '\0';
63
64    syslog(priority, message, length);
65}
66
67
Note: See TracBrowser for help on using the repository browser.