source: trunk/src/log.h @ 2183

Last change on this file since 2183 was 2183, checked in by sam, 10 years ago

build: fix the WTFPL site URL in all code comments.

  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://www.wtfpl.net/ for more details.
9//
10
11//
12// The Log interface
13// -----------------
14// The central logging system.
15//
16
17#if !defined __LOL_LOG_H__
18#define __LOL_LOG_H__
19
20#include <stdint.h>
21#include <cstdarg>
22
23namespace lol
24{
25
26class Log
27{
28public:
29#ifdef __GNUC__
30#   define LOL_FMT_ATTR(n, p) __attribute__((format(printf, n, p)))
31#else
32#   define LOL_FMT_ATTR(n, p)
33#endif
34    static void Debug(char const *format, ...) LOL_FMT_ATTR(1, 2);
35    static void Info(char const *format, ...) LOL_FMT_ATTR(1, 2);
36    static void Warn(char const *format, ...) LOL_FMT_ATTR(1, 2);
37    static void Error(char const *format, ...) LOL_FMT_ATTR(1, 2);
38#undef LOL_FMT_ATTR
39
40private:
41    enum MessageType
42    {
43        DebugMessage,
44        InfoMessage,
45        WarnMessage,
46        ErrorMessage
47    };
48
49    static void Helper(MessageType type, char const *fmt, va_list ap);
50};
51
52} /* namespace lol */
53
54#endif // __LOL_LOG_H__
55
Note: See TracBrowser for help on using the repository browser.