source: trunk/src/log.cpp @ 1513

Last change on this file since 1513 was 1513, checked in by sam, 8 years ago

core: replace usage of sin() or std::sin() with lol::sin() where appropriate.

  • Property svn:keywords set to Id
File size: 1.6 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://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
14
15#include <cstdio>
16
17#if defined __ANDROID__
18#   include <android/log.h>
19#else
20#   include <cstdarg>
21#endif
22
23#include "core.h"
24
25namespace lol
26{
27
28/*
29 * Public Log class
30 */
31
32void Log::Debug(char const *fmt, ...)
33{
34    va_list ap;
35    va_start(ap, fmt);
36#if defined __ANDROID__
37    __android_log_vprint(ANDROID_LOG_DEBUG, "LOL", fmt, ap);
38#else
39    fprintf(stderr, "DEBUG: ");
40    vfprintf(stderr, fmt, ap);
41#endif
42    va_end(ap);
43}
44
45void Log::Info(char const *fmt, ...)
46{
47    va_list ap;
48    va_start(ap, fmt);
49#if defined __ANDROID__
50    __android_log_vprint(ANDROID_LOG_INFO, "LOL", fmt, ap);
51#else
52    fprintf(stderr, "INFO: ");
53    vfprintf(stderr, fmt, ap);
54#endif
55    va_end(ap);
56}
57
58void Log::Warn(char const *fmt, ...)
59{
60    va_list ap;
61    va_start(ap, fmt);
62#if defined __ANDROID__
63    __android_log_vprint(ANDROID_LOG_WARN, "LOL", fmt, ap);
64#else
65    fprintf(stderr, "WARN: ");
66    vfprintf(stderr, fmt, ap);
67#endif
68    va_end(ap);
69}
70
71void Log::Error(char const *fmt, ...)
72{
73    va_list ap;
74    va_start(ap, fmt);
75#if defined __ANDROID__
76    __android_log_vprint(ANDROID_LOG_ERROR, "LOL", fmt, ap);
77#else
78    fprintf(stderr, "ERROR: ");
79    vfprintf(stderr, fmt, ap);
80#endif
81    va_end(ap);
82}
83
84} /* namespace lol */
85
Note: See TracBrowser for help on using the repository browser.