-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_log_8h_source.html
79 lines (79 loc) · 21.5 KB
/
_log_8h_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Gamedev Framework (gf): Log.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="gf_logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Gamedev Framework (gf)
 <span id="projectnumber">0.11.0</span>
</div>
<div id="projectbrief">A C++14 framework for 2D games</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_6d069d519ae9d12fa11dd8e685586b60.html">gf</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Log.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Gamedev Framework (gf)</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> * Copyright (C) 2016-2018 Julien Bernard</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> *</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * This software is provided 'as-is', without any express or implied</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * warranty. In no event will the authors be held liable for any damages</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * arising from the use of this software.</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> *</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * Permission is granted to anyone to use this software for any purpose,</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * including commercial applications, and to alter it and redistribute it</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * freely, subject to the following restrictions:</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> *</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * 1. The origin of this software must not be misrepresented; you must not</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * claim that you wrote the original software. If you use this software</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * in a product, an acknowledgment in the product documentation would be</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * appreciated but is not required.</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * 2. Altered source versions must be plainly marked as such, and must not be</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * misrepresented as being the original software.</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * 3. This notice may not be removed or altered from any source distribution.</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> */</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#ifndef GF_LOG_H</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#define GF_LOG_H</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <cstdarg></span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include <cstdlib></span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include <map></span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "Portability.h"</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="keyword">namespace </span><a class="code" href="namespacegf.html">gf</a> {</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor">#ifndef DOXYGEN_SHOULD_SKIP_THIS</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">inline</span> <span class="keyword">namespace </span>v1 {</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> </div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html"> 59</a></span>  <span class="keyword">class </span>GF_API <a class="code" href="classgf_1_1_log.html">Log</a> {</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <a class="code" href="classgf_1_1_log.html">Log</a>() = <span class="keyword">delete</span>;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9"> 69</a></span>  <span class="keyword">enum</span> <a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9">Level</a> : <span class="keywordtype">int</span> {</div><div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9aee60afc6cba066b732b213601778a367"> 70</a></span>  <a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9aee60afc6cba066b732b213601778a367">Debug</a>, </div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9a7c5b65d5b2e371bcf8f87b0c76e3c9a4"> 71</a></span>  <a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9a7c5b65d5b2e371bcf8f87b0c76e3c9a4">Info</a>, </div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9ada3339d51ffda45fedd7e2e3cb3a1a4d"> 72</a></span>  <a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9ada3339d51ffda45fedd7e2e3cb3a1a4d">Warn</a>, </div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9a118521004409bf63749d72d44fefc6be"> 73</a></span>  <a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9a118521004409bf63749d72d44fefc6be">Error</a>, </div><div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9af8edecce5f04d5303579a7b73f6922f5"> 74</a></span>  <a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9af8edecce5f04d5303579a7b73f6922f5">Fatal</a>, </div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  };</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keyword">static</span> <span class="keywordtype">void</span> setLevel(<a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9">Level</a> level);</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span> </div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#a1914b7e55ed934bc01fc50d78602fae0"> 89</a></span>  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classgf_1_1_log.html#a1914b7e55ed934bc01fc50d78602fae0">debug</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...) GF_FORMAT(1, 2) {</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  va_list ap;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  va_start(ap, fmt);</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  log(Level::Debug, fmt, ap);</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  va_end(ap);</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  }</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div><div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#aac6d0440d94f42b8834f44256bbdb01e"> 101</a></span>  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classgf_1_1_log.html#aac6d0440d94f42b8834f44256bbdb01e">info</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...) GF_FORMAT(1, 2) {</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  va_list ap;</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  va_start(ap, fmt);</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  log(Level::Info, fmt, ap);</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  va_end(ap);</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  }</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> </div><div class="line"><a name="l00113"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#aa4d71938c073d439a4eb35a61fb51f52"> 113</a></span>  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classgf_1_1_log.html#aa4d71938c073d439a4eb35a61fb51f52">warning</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...) GF_FORMAT(1, 2) {</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  va_list ap;</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  va_start(ap, fmt);</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  log(Level::Warn, fmt, ap);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  va_end(ap);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  }</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span> </div><div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#aa0a0d0af1636e2c19abbca9591e266fa"> 125</a></span>  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classgf_1_1_log.html#aa0a0d0af1636e2c19abbca9591e266fa">error</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...) GF_FORMAT(1, 2) {</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  va_list ap;</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  va_start(ap, fmt);</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  log(Level::Error, fmt, ap);</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  va_end(ap);</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  }</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div><div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="classgf_1_1_log.html#a40b55ae5841af7607d217614bcacc911"> 137</a></span>  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classgf_1_1_log.html#a40b55ae5841af7607d217614bcacc911">fatal</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...) GF_FORMAT(1, 2) {</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  va_list ap;</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  va_start(ap, fmt);</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  log(Level::Fatal, fmt, ap);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  va_end(ap);</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span> </div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  std::abort();</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  }</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> </div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keyword">static</span> <a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9">Level</a> s_level;</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> </div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  <span class="keyword">private</span>:</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="keyword">static</span> <span class="keywordtype">void</span> log(<a class="code" href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9">Level</a> level, <span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, va_list ap);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  };</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span> </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span> <span class="preprocessor">#ifndef DOXYGEN_SHOULD_SKIP_THIS</span></div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span> }</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> <span class="preprocessor">#endif</span></div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> }</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span> </div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> <span class="preprocessor">#endif // GF_LOG_H</span></div><div class="ttc" id="classgf_1_1_log_html_a09dcebe6e9d911a2d9d099115508edf9af8edecce5f04d5303579a7b73f6922f5"><div class="ttname"><a href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9af8edecce5f04d5303579a7b73f6922f5">gf::Log::Fatal</a></div><div class="ttdoc">The fatal level. </div><div class="ttdef"><b>Definition:</b> Log.h:74</div></div>
<div class="ttc" id="classgf_1_1_log_html_a09dcebe6e9d911a2d9d099115508edf9"><div class="ttname"><a href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9">gf::Log::Level</a></div><div class="ttdeci">Level</div><div class="ttdoc">The severity level of the log. </div><div class="ttdef"><b>Definition:</b> Log.h:69</div></div>
<div class="ttc" id="classgf_1_1_log_html_aa0a0d0af1636e2c19abbca9591e266fa"><div class="ttname"><a href="classgf_1_1_log.html#aa0a0d0af1636e2c19abbca9591e266fa">gf::Log::error</a></div><div class="ttdeci">static void error(const char *fmt,...)</div><div class="ttdoc">Print an error message. </div><div class="ttdef"><b>Definition:</b> Log.h:125</div></div>
<div class="ttc" id="classgf_1_1_log_html_a09dcebe6e9d911a2d9d099115508edf9ada3339d51ffda45fedd7e2e3cb3a1a4d"><div class="ttname"><a href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9ada3339d51ffda45fedd7e2e3cb3a1a4d">gf::Log::Warn</a></div><div class="ttdoc">The warn level. </div><div class="ttdef"><b>Definition:</b> Log.h:72</div></div>
<div class="ttc" id="classgf_1_1_log_html_a40b55ae5841af7607d217614bcacc911"><div class="ttname"><a href="classgf_1_1_log.html#a40b55ae5841af7607d217614bcacc911">gf::Log::fatal</a></div><div class="ttdeci">static void fatal(const char *fmt,...)</div><div class="ttdoc">Print a fatal message and quit. </div><div class="ttdef"><b>Definition:</b> Log.h:137</div></div>
<div class="ttc" id="classgf_1_1_log_html_a09dcebe6e9d911a2d9d099115508edf9aee60afc6cba066b732b213601778a367"><div class="ttname"><a href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9aee60afc6cba066b732b213601778a367">gf::Log::Debug</a></div><div class="ttdoc">The debug level. </div><div class="ttdef"><b>Definition:</b> Log.h:70</div></div>
<div class="ttc" id="classgf_1_1_log_html_aa4d71938c073d439a4eb35a61fb51f52"><div class="ttname"><a href="classgf_1_1_log.html#aa4d71938c073d439a4eb35a61fb51f52">gf::Log::warning</a></div><div class="ttdeci">static void warning(const char *fmt,...)</div><div class="ttdoc">Print a warning message. </div><div class="ttdef"><b>Definition:</b> Log.h:113</div></div>
<div class="ttc" id="namespacegf_html"><div class="ttname"><a href="namespacegf.html">gf</a></div><div class="ttdoc">The namespace for gf classes. </div><div class="ttdef"><b>Definition:</b> Action.h:35</div></div>
<div class="ttc" id="classgf_1_1_log_html_aac6d0440d94f42b8834f44256bbdb01e"><div class="ttname"><a href="classgf_1_1_log.html#aac6d0440d94f42b8834f44256bbdb01e">gf::Log::info</a></div><div class="ttdeci">static void info(const char *fmt,...)</div><div class="ttdoc">Print an info message. </div><div class="ttdef"><b>Definition:</b> Log.h:101</div></div>
<div class="ttc" id="classgf_1_1_log_html"><div class="ttname"><a href="classgf_1_1_log.html">gf::Log</a></div><div class="ttdoc">Logging functions. </div><div class="ttdef"><b>Definition:</b> Log.h:59</div></div>
<div class="ttc" id="classgf_1_1_log_html_a1914b7e55ed934bc01fc50d78602fae0"><div class="ttname"><a href="classgf_1_1_log.html#a1914b7e55ed934bc01fc50d78602fae0">gf::Log::debug</a></div><div class="ttdeci">static void debug(const char *fmt,...)</div><div class="ttdoc">Print a debug message. </div><div class="ttdef"><b>Definition:</b> Log.h:89</div></div>
<div class="ttc" id="classgf_1_1_log_html_a09dcebe6e9d911a2d9d099115508edf9a118521004409bf63749d72d44fefc6be"><div class="ttname"><a href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9a118521004409bf63749d72d44fefc6be">gf::Log::Error</a></div><div class="ttdoc">The error level. </div><div class="ttdef"><b>Definition:</b> Log.h:73</div></div>
<div class="ttc" id="classgf_1_1_log_html_a09dcebe6e9d911a2d9d099115508edf9a7c5b65d5b2e371bcf8f87b0c76e3c9a4"><div class="ttname"><a href="classgf_1_1_log.html#a09dcebe6e9d911a2d9d099115508edf9a7c5b65d5b2e371bcf8f87b0c76e3c9a4">gf::Log::Info</a></div><div class="ttdoc">The info level. </div><div class="ttdef"><b>Definition:</b> Log.h:71</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>