slogcxx.h File Reference

Logging class to write messages to console and file. More...

#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>

Go to the source code of this file.

Classes

class  Where
 A class to allow the WHERE macro to work. More...
class  Slog
 simple logging class with a ostream like (<<) interface More...
class  LogState
 Put this sucker on the stack to save your state. More...

Defines

#define UNUSED
 GNU CC attribute to denote unused paramters in function calls. The attribute remove compiler warning for unused arguments and variable. Only works for GNU compilers such as gcc and g++.
#define EXIT_DEBUG(why)
 Simple macro to terminate execution early while debugging.
#define WHERE   Where(__FILE__,__LINE__,__FUNCTION__)
 Manipulator like item that writes out the location of the log entry.

Enumerations

enum  LogLevelsEnum {
  ALWAYS = INT_MIN, TERSE = 1, TRACE, VERBOSE,
  BOMBASTIC, NEVER = INT_MAX
}
 Logging levels. More...

Functions

Slogoperator<< (Slog &s, Slog &(*manip)(Slog &))
 Allow the use of iomanipulators.
Slogendl (Slog &s)
 endl terminates a log... similar to std::endl
Slogdecl (Slog &s)
 make the message MORE likely to show up
Slogincl (Slog &s)
 make the message LESS likely to show up
Slogoperator<< (Slog &s, const int &r)
 Allow logging of ints.
Slogoperator<< (Slog &s, const size_t &r)
 32/64 bit safe unsigned numbers
Slogoperator<< (Slog &s, const char *str)
 Allow logging of C strings.
Slogoperator<< (Slog &s, const std::string &str)
 Log a string.
Slogoperator<< (Slog &s, const char &c)
 Log insertion of a single character.
Slogoperator<< (Slog &s, const short &sh)
 Insert a short integer.
Slogoperator<< (Slog &s, const long &l)
 Insert a long integer.
Slogoperator<< (Slog &s, const float &f)
 Insert a 4 byte float.
Slogoperator<< (Slog &s, const double &d)
 Insert a 8 byte float.
Slogoperator<< (Slog &s, const Where &w)
 Insert where object.


Detailed Description

Logging class to write messages to console and file.

Copyright (c) 2006 Kurt Schwehr Data Visualization Research Lab, Center for Coastal and Ocean Mapping University of New Hampshire. http://ccom.unh.edu

Todo:
FIX: make namespaces work

FIX: put macros that do __FILE__ and __LINE__ additions


Define Documentation

#define EXIT_DEBUG why   ) 
 

Value:

std::cerr << "EXIT_DEBUG called at " \
  << __FILE__ << ":" << __LINE__<<": in function '" <<__FUNCTION__ << "'\n" \
  << "  STATED REASON: " << why << std::endl;                           \
  exit(EXIT_FAILURE);
Simple macro to terminate execution early while debugging.

#define UNUSED
 

GNU CC attribute to denote unused paramters in function calls. The attribute remove compiler warning for unused arguments and variable. Only works for GNU compilers such as gcc and g++.

http://gcc.gnu.org/onlinedocs/gcc-3.4.2/gcc/Variable-Attributes.html

#define WHERE   Where(__FILE__,__LINE__,__FUNCTION__)
 

Manipulator like item that writes out the location of the log entry.

 Slog l;
 l << WHERE << "Example of recording where in the code we are" << endl;


Enumeration Type Documentation

enum LogLevelsEnum
 

Logging levels.

Think of them from the perspective of the runtime requested verbosity. If the user sets their logging level to TERSE, then they will receive messages with message levels for ALWAYS and TERSE.

When writing log messages in the program, choose the log level or higher that the message will appear at. For things that will generate massive spewage, select the bombastic level. Log messages that use the NEVER tag will not show up (no matter what). ALWAYS log messages can not be turned off (if logging is enabled.


Generated on Tue Aug 15 10:09:38 2006 by  doxygen 1.4.6