Path: blob/main/system/include/SDL/SDL_log.h
6169 views
/*1Simple DirectMedia Layer2Copyright (C) 1997-2011 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/2021/**22* \file SDL_log.h23*24* Simple log messages with categories and priorities.25*26* By default logs are quiet, but if you're debugging SDL you might want:27*28* SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);29*30* Here's where the messages go on different platforms:31* Windows: debug output stream32* Android: log output33* Others: standard error output (stderr)34*/3536#ifndef _SDL_log_h37#define _SDL_log_h3839#include "SDL_stdinc.h"4041#include "begin_code.h"42/* Set up for C function definitions, even when using C++ */43#ifdef __cplusplus44/* *INDENT-OFF* */45extern "C" {46/* *INDENT-ON* */47#endif484950/**51* \brief The maximum size of a log message52*53* Messages longer than the maximum size will be truncated54*/55#define SDL_MAX_LOG_MESSAGE 40965657/**58* \brief The predefined log categories59*60* By default the application category is enabled at the INFO level,61* and all other categories are enabled at the CRITICAL level.62*/63enum64{65SDL_LOG_CATEGORY_APPLICATION,66SDL_LOG_CATEGORY_ERROR,67SDL_LOG_CATEGORY_SYSTEM,68SDL_LOG_CATEGORY_AUDIO,69SDL_LOG_CATEGORY_VIDEO,70SDL_LOG_CATEGORY_RENDER,71SDL_LOG_CATEGORY_INPUT,7273/* Reserved for future SDL library use */74SDL_LOG_CATEGORY_RESERVED1,75SDL_LOG_CATEGORY_RESERVED2,76SDL_LOG_CATEGORY_RESERVED3,77SDL_LOG_CATEGORY_RESERVED4,78SDL_LOG_CATEGORY_RESERVED5,79SDL_LOG_CATEGORY_RESERVED6,80SDL_LOG_CATEGORY_RESERVED7,81SDL_LOG_CATEGORY_RESERVED8,82SDL_LOG_CATEGORY_RESERVED9,83SDL_LOG_CATEGORY_RESERVED10,8485/* Beyond this point is reserved for application use, e.g.86enum {87MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,88MYAPP_CATEGORY_AWESOME2,89MYAPP_CATEGORY_AWESOME3,90...91};92*/93SDL_LOG_CATEGORY_CUSTOM94};9596/**97* \brief The predefined log priorities98*/99typedef enum100{101SDL_LOG_PRIORITY_VERBOSE = 1,102SDL_LOG_PRIORITY_DEBUG,103SDL_LOG_PRIORITY_INFO,104SDL_LOG_PRIORITY_WARN,105SDL_LOG_PRIORITY_ERROR,106SDL_LOG_PRIORITY_CRITICAL,107SDL_NUM_LOG_PRIORITIES108} SDL_LogPriority;109110111/**112* \brief Set the priority of all log categories113*/114extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);115116/**117* \brief Set the priority of a particular log category118*/119extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,120SDL_LogPriority priority);121122/**123* \brief Set the priority of a particular log category124*/125extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);126127/**128* \brief Reset all priorities to default.129*130* \note This is called in SDL_Quit().131*/132extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);133134/**135* \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO136*/137extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);138139/**140* \brief Log a message with SDL_LOG_PRIORITY_VERBOSE141*/142extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);143144/**145* \brief Log a message with SDL_LOG_PRIORITY_DEBUG146*/147extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...);148149/**150* \brief Log a message with SDL_LOG_PRIORITY_INFO151*/152extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);153154/**155* \brief Log a message with SDL_LOG_PRIORITY_WARN156*/157extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);158159/**160* \brief Log a message with SDL_LOG_PRIORITY_ERROR161*/162extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);163164/**165* \brief Log a message with SDL_LOG_PRIORITY_CRITICAL166*/167extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);168169/**170* \brief Log a message with the specified category and priority.171*/172extern DECLSPEC void SDLCALL SDL_LogMessage(int category,173SDL_LogPriority priority,174const char *fmt, ...);175176/**177* \brief Log a message with the specified category and priority.178*/179extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,180SDL_LogPriority priority,181const char *fmt, va_list ap);182183/**184* \brief The prototype for the log output function185*/186typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);187188/**189* \brief Get the current log output function.190*/191extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);192193/**194* \brief This function allows you to replace the default log output195* function with one of your own.196*/197extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);198199200/* Ends C function definitions when using C++ */201#ifdef __cplusplus202/* *INDENT-OFF* */203}204/* *INDENT-ON* */205#endif206#include "close_code.h"207208#endif /* _SDL_log_h */209210/* vi: set ts=4 sw=4 expandtab: */211212213