aboutsummaryrefslogtreecommitdiff
path: root/textures/base/pack/progress_bar_bg.png
blob: 4e30ae889deb94fd1db1b65c03f2bf95ae33b5be (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 00 00 00 00 30 08 06 00 00 00 fe 7f a4 .PNG........IHDR.......0........
0020 7f 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0f 61 00 .....bKGD..............pHYs...a.
0040 00 0f 61 01 a8 3f a7 69 00 00 00 07 74 49 4d 45 07 e1 03 09 16 38 31 75 8e 34 de 00 00 00 ef 49 ..a..?.i....tIME.....81u.4.....I
0060 44 41 54 78 da ed d8 b1 0d 82 40 14 80 61 ce 30 08 26 38 01 05 4e 40 c1 28 0c 48 c1 04 6a c2 04 DATx......@..a.0.&8..N@.(.H..j..
0080 16 36 36 16 26 6e 80 8d 85 80 a1 b0 bb dc f7 75 1c dd 4b f8 f3 8e d0 75 5d b6 65 e8 c7 29 03 62 .66.&n.........u..K....u].e..).b
00a0 15 b6 5e ee cc 07 d2 25 00 20 00 40 8a f2 d7 f3 3e 3b b8 9c 1f b3 3b 7f d3 56 a6 04 91 fa f1 0f ..^....%...@....>;....;..V......
00c0 2f d8 00 00 01 00 01 00 92 15 ca a2 76 e7 87 74 fe 09 d8 00 00 01 00 01 30 02 10 00 40 00 00 01 /...........v..t........0...@...
00e0 00 04 00 10 00 40 00 00 01 00 04 00 10 00 40 00 00 01 00 04 00 10 00 40 00 00 01 00 04 00 10 00 .....@........@........@........
0100 40 00 00 01 00 04 00 10 00 40 00 00 01 00 04 00 10 00 40 00 00 01 00 04 00 f8 4f 28 8b 7a 79 36 @........@........@.......O(.zy6
0120 7d 3f 34 6d 65 4a 10 a9 a1 1f 57 df bc 0d 00 10 00 10 00 20 59 f9 f2 e0 7a 3b cd ee 08 87 fd 71 }?4meJ....W.........Y...z;.....q
0140 32 26 88 56 b0 01 00 02 00 08 00 f0 f1 06 70 1d 1c 0f 2c 45 4c 5e 00 00 00 00 49 45 4e 44 ae 42 2&.V..........p...,EL^....IEND.B
0160 60 82 `.
a id='n106' href='#n106'>106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#pragma once

#include <map>
#include <queue>
#include <string>
#include <fstream>
#include <thread>
#include <mutex>
#if !defined(_WIN32)  // POSIX
	#include <unistd.h>
#endif
#include "irrlichttypes.h"

class ILogOutput;

enum LogLevel {
	LL_NONE, // Special level that is always printed
	LL_ERROR,
	LL_WARNING,
	LL_ACTION,  // In-game actions
	LL_INFO,
	LL_VERBOSE,
	LL_MAX,
};

enum LogColor {
	LOG_COLOR_NEVER,
	LOG_COLOR_ALWAYS,
	LOG_COLOR_AUTO,
};

typedef u8 LogLevelMask;
#define LOGLEVEL_TO_MASKLEVEL(x) (1 << x)

class Logger {
public:
	void addOutput(ILogOutput *out);
	void addOutput(ILogOutput *out, LogLevel lev);
	void addOutputMasked(ILogOutput *out, LogLevelMask mask);
	void addOutputMaxLevel(ILogOutput *out, LogLevel lev);
	LogLevelMask removeOutput(ILogOutput *out);
	void setLevelSilenced(LogLevel lev, bool silenced);

	void registerThread(const std::string &name);
	void deregisterThread();

	void log(LogLevel lev, const std::string &text);
	// Logs without a prefix
	void logRaw(LogLevel lev, const std::string &text);

	void setTraceEnabled(bool enable) { m_trace_enabled = enable; }
	bool getTraceEnabled() { return m_trace_enabled; }

	static LogLevel stringToLevel(const std::string &name);
	static const std::string getLevelLabel(LogLevel lev);

	static LogColor color_mode;

private:
	void logToOutputsRaw(LogLevel, const std::string &line);
	void logToOutputs(LogLevel, const std::string &combined,
		const std::string &time, const std::string &thread_name,
		const std::string &payload_text);

	const std::string getThreadName();