source: cpp/common/log.h @ 1197

Last change on this file since 1197 was 875, checked in by Maciej Komosinski, 6 years ago

Better use of LOG_level constants

  • Property svn:eol-style set to native
File size: 1.4 KB
RevLine 
[286]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
[874]2// Copyright (C) 1999-2019  Maciej Komosinski and Szymon Ulatowski.
[286]3// See LICENSE.txt for details.
[122]4
[375]5#ifndef _COMMON_LOG_H_
6#define _COMMON_LOG_H_
[109]7
8#include <stdarg.h>
9
[874]10extern const char* LOG_LEVEL_ARRAY[];
[375]11#define LOG_FORMAT "%s%s.%s: %s"
12#define LOG_MULTILINE_CONTINUATION "..."
[109]13
[375]14void logPrintf(const char *obj, const char *method, int level, const char *msgf, ...);
15void logPrintf_va(const char *obj, const char *method, int level, const char *msgf, va_list va); //a different name than logPrintf - otherwise the compiler could confuse the "string" parameter with va_list and could call the wrong function
16void log_printf(const char *msgf, ...); //a shorthand for printf (a different name again to avoid the risk of confusion with the two functions above. This would be unlikely but possible when the argument types would match)
17void logMessage(const char *obj, const char *method, int level, const char *msg);
[874]18const char* logLevelName(int level);
[244]19
[109]20
[375]21//level (importance) of a message
[875]22#define LOG_MIN LOG_DEBUG
[375]23#define LOG_DEBUG -1 //debugging information, not needed for final users
24#define LOG_INFO 0 //information
25#define LOG_WARN 1 //warning or corrected error
26#define LOG_ERROR 2 //uncorrected error, can cause malfunction
27#define LOG_CRITICAL 3 //serious error, causes side effects. User should save what can be saved and restart the application
[875]28#define LOG_MAX LOG_CRITICAL
[375]29
[109]30#endif
Note: See TracBrowser for help on using the repository browser.