SeaBreeze
Data Structures | Macros | Functions
Log.h File Reference

Interface to Log. More...

#include "api/DllDecl.h"
#include <string>
#include <stack>
#include <stdio.h>
#include <stdarg.h>

Go to the source code of this file.

Data Structures

class  Log
 Simple logger for OOI applications. More...
 

Macros

#define OOI_LOG_PRINT   0
 
#define LOG(s)   Log logger(s);
 instantiate logger in the current function More...
 
#define LOG_DEBUG(s)   do { if (OOI_LOG_PRINT) logger.debug s; } while (0)
 log a printf string (and optional arguments) if debugging is enabled More...
 
#define LOG_INFO(s)   do { if (OOI_LOG_PRINT) logger.info s; } while (0)
 
#define LOG_WARN(s)   do { if (OOI_LOG_PRINT) logger.warn s; } while (0)
 
#define LOG_ERROR(s)   do { if (OOI_LOG_PRINT) logger.error s; } while (0)
 
#define OOI_LOG_LEVEL_NEVER   0
 
#define OOI_LOG_LEVEL_ERROR   1
 
#define OOI_LOG_LEVEL_WARN   2
 
#define OOI_LOG_LEVEL_INFO   3
 
#define OOI_LOG_LEVEL_DEBUG   4
 
#define OOI_LOG_LEVEL_TRACE   5
 

Functions

void DLL_DECL seabreeze_log_set_level_int (int lvl)
 
void DLL_DECL seabreeze_log_set_level_string (const char *s)
 
void DLL_DECL seabreeze_log_debug (const char *fmt,...)
 
void DLL_DECL seabreeze_log_info (const char *fmt,...)
 
void DLL_DECL seabreeze_log_warn (const char *fmt,...)
 
void DLL_DECL seabreeze_log_error (const char *fmt,...)
 

Detailed Description

Interface to Log.

Author
Mark Zieg mark..nosp@m.zieg.nosp@m.@ocea.nosp@m.nopt.nosp@m.ics.c.nosp@m.om

LICENSE:

SeaBreeze Copyright (C) 2014, Ocean Optics Inc

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Macro Definition Documentation

◆ LOG

#define LOG (   s)    Log logger(s);

instantiate logger in the current function

Parameters
s(Input) function name (typically FUNCTION)

◆ LOG_DEBUG

#define LOG_DEBUG (   s)    do { if (OOI_LOG_PRINT) logger.debug s; } while (0)

log a printf string (and optional arguments) if debugging is enabled

Note
double parens: call as LOG_DEBUG(("variable x is %d, y is %f", x, y));
See also
http://stackoverflow.com/questions/1644868/c-define-macro-for-debug-printing

◆ LOG_INFO

#define LOG_INFO (   s)    do { if (OOI_LOG_PRINT) logger.info s; } while (0)
See also
LOG_DEBUG

◆ LOG_WARN

#define LOG_WARN (   s)    do { if (OOI_LOG_PRINT) logger.warn s; } while (0)
See also
LOG_DEBUG

◆ LOG_ERROR

#define LOG_ERROR (   s)    do { if (OOI_LOG_PRINT) logger.error s; } while (0)
See also
LOG_DEBUG