ofs | hex dump | ascii |
---|
0000 | 42 42 33 44 1d 33 00 00 01 00 00 00 54 45 58 53 36 00 00 00 61 64 76 74 72 61 69 6e 73 5f 72 65 | BB3D.3......TEXS6...advtrains_re |
0020 | 74 72 6f 73 69 67 6e 61 6c 2e 70 6e 67 00 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 | trosignal.png................... |
0040 | 80 3f 00 00 80 3f 00 00 00 00 42 52 55 53 2e 00 00 00 01 00 00 00 42 72 75 73 68 2e 30 30 31 00 | .?...?....BRUS........Brush.001. |
0060 | 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 | ...?...?...?...?................ |
0080 | 4e 4f 44 45 9d 32 00 00 43 75 62 65 2e 30 30 30 00 00 00 80 b0 00 00 00 00 00 00 00 00 fe ff 7f | NODE.2..Cube.000................ |
00a0 | 3f 00 00 80 3f 00 00 80 3f ea 40 6d 3e 2f b8 a5 bd bb 5b 66 bf 42 a6 b8 3e 4d 45 53 48 64 32 00 | ?...?...?.@m>/....[f.B..>MESHd2. |
00c0 | 00 ff ff ff ff 56 52 54 53 8c 2b 00 00 01 00 00 00 01 00 00 00 02 00 00 00 e3 35 af bd 39 fa ba | .....VRTS.+...............5..9.. |
00e0 | 3f be 50 76 bf 28 cd 13 bf 28 cd 13 bf 28 cd 13 3f 98 e5 52 3f f6 af 5f 3f e3 35 af bd 39 fa ba | ?.Pv.(...(...(..?..R?.._?.5..9.. |
0100 | 3f 0c c6 3b c0 6a 03 35 bf 6a 03 35 bf 00 00 00 00 36 c7 86 3e ff af 5f 3f e3 35 af bd c7 36 dd | ?..;.j.5.j.5.....6..>.._?.5...6. |
0120 | 3f 0c c6 3b c0 6a 03 35 bf 6a 03 35 3f 00 00 00 00 34 c7 86 3e 7d 38 4c 3f e3 35 af bd c7 36 dd | ?..;.j.5.j.5?....4..>}8L?.5...6. |
0140 | 3f be 50 76 bf 28 cd 13 bf 28 cd 13 3f 28 cd 13 3f 96 e5 52 3f 77 38 4c 3f e3 35 af bd c7 36 dd | ?.Pv.(...(..?(..?..R?w8L?.5...6. |
0160 | 3f be 50 76 bf 28 cd 13 bf 28 cd 13 3f 28 cd 13 3f 96 e5 52 3f 77 38 4c 3f 6a 5d a5 bc c7 36 dd | ?.Pv.(...(..?(..?..R?w8L?j]...6. |
0180 | 3f be 50 76 bf 28 cd 13 3f 28 cd 13 3f 28 cd 13 3f 96 e5 52 3f 95 76 47 3f 6a 5d a5 bc 39 fa ba | ?.Pv.(..?(..?(..?..R?.vG?j]..9.. |
01a0 | 3f be 50 76 bf 28 cd 13 3f 28 cd 13 bf 28 cd 13 3f 18 5d 66 3f 94 76 47 3f e3 35 af bd 39 fa ba | ?.Pv.(..?(...(..?.]f?.vG?.5..9.. |
01c0 | 3f be 50 76 bf 28 cd 13 bf 28 cd 13 bf 28 cd 13 3f 18 5d 66 3f 77 38 4c 3f 6a 5d a5 bc c7 36 dd | ?.Pv.(...(...(..?.]f?w8L?j]...6. |
01e0 | 3f be 50 76 bf 28 cd 13 3f 28 cd 13 3f 28 cd 13 3f 96 e5 52 3f 59 e9 77 3f 6a 5d a5 bc c7 36 dd | ?.Pv.(..?(..?(..?..R?Y.w?j]...6. |
0200 | 3f 0c c6 3b c0 6a 03 35 3f 6a 03 35 3f 00 00 00 00 34 c7 86 3e 4c e9 77 3f 6a 5d a5 bc 39 fa ba | ?..;.j.5?j.5?....4..>L.w?j]..9.. |
0220 | 3f 0c c6 3b c0 6a 03 35 3f 6a 03 35 bf 00 00 00 00 3c c7 86 3e ce 71 64 3f 6a 5d a5 bc 39 fa ba | ?..;.j.5?j.5.....<..>.qd?j]..9.. |
0240 | 3f be 50 76 bf 28 cd 13 3f 28 cd 13 bf 28 cd 13 3f 99 e5 52 3f d8 71 64 3f e3 35 af bd 39 fa ba | ?.Pv.(..?(...(..?..R?.qd?.5..9.. |
0260 | 3f 0c c6 3b c0 6a 03 35 bf 6a 03 35 bf 00 00 00 00 36 c7 86 3e ff af 5f 3f e3 35 af bd 39 fa ba | ?..;.j.5.j.5.....6..>.._?.5..9.. |
0280 | 3f be 50 76 bf 28 cd 13 bf 28 cd 13 bf 28 cd 13 3f 98 e5 52 3f f6 af 5f 3f 6a 5d a5 bc 39 fa ba | ?.Pv.(...(...(..?..R?.._?j]..9.. |
02a0 | 3f be 50 76 bf 28 cd 13 3f 28 cd 13 bf 28 cd 13 3f 99 e5 52 3f d8 71 64 3f 6a 5d a5 bc 39 fa ba | ?.Pv.(..?(...(..?..R?.qd?j]..9.. |
02c0 | 3f 0c c6 3b c0 6a 03 35 3f 6a 03 35 bf 00 00 00 00 3c c7 86 3e ce 71 64 3f 6a 5d a5 bc c7 36 dd | ?..;.j.5?j.5.....<..>.qd?j]...6. |
02e0 | 3f 0c c6 3b c0 6a 03 35 3f 6a 03 35 3f 00 00 00 00 34 c7 86 3e af 76 47 3f 6a 5d a5 bc c7 36 dd | ?..;.j.5?j.5?....4..>.vG?j]...6. |
0300 | 3f be 50 76 bf 28 cd 13 3f 28 cd 13 3f 28 cd 13 3f 96 e5 52 3f 95 76 47 3f e3 35 af bd c7 36 dd | ?.Pv.(..?(..?(..?..R?.vG?.5...6. |
0320 | 3f be 50 76 bf 28 cd 13 bf 28 cd 13 3f 28 cd 13 3f 96 e5 52 3f 77 38 4c 3f e3 35 af bd c7 36 dd | ?.Pv.(...(..?(..?..R?w8L?.5...6. |
0340 | 3f 0c c6 3b c0 6a 03 35 bf 6a 03 35 3f 00 00 00 00 34 c7 86 3e 7d 38 4c 3f e0 df d0 3a 5f e9 e4 | ?..;.j.5.j.5?....4..>}8L?...:_.. |
0360 | 3f f8 41 3a c0 69 6d 34 3f 4e fb 26 3f 1e c5 8e be 89 fb 95 3e 14 47 2e 3f 40 c1 d2 bd f7 46 e5 | ?.A:.im4?N.&?.......>.G.?@....F. |
0380 | 3f f5 41 3a c0 55 7f 2a bf 62 2d 31 3f 1d 71 8e be fb c3 86 3e c4 46 2e 3f 30 e9 d3 bd c9 e5 e2 | ?.A:.U.*.b-1?.q.....>.F.?0...... |
03a0 | 3f 0f 7c 3c c0 56 fd 2a bf 40 /*
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 | ?..(.a.0?.a.=n.6?...>.o.?....... |
0800 | 3f d2 b1 28 c0 5d 67 2e bf 4d 79 26 3e 6d b5 36 3f 83 b5 86 3e b0 6e 14 3f 18 86 d9 bd 63 57 d7 | ?..(.]g..My&>m.6?...>.n.?....cW. |
0820 | 3f 79 6d 29 c0 5b 65 2d bf 32 11 99 3e 58 11 2c 3f 87 b9 86 3e d0 4d 17 3f 20 55 e0 ba cd f9 d6 | ?ym).[e-.2..>X.,?...>.M.?.U..... |
0840 | 3f 7c 6d 29 c0 63 83 31 3
// Should implement atomic loads and stores (even though it's only
// written to when one thread has access currently).
// Works on all known architectures (x86, ARM, MIPS).
volatile bool m_silenced_levels[LL_MAX];
std::map<std::thread::id, std::string> m_thread_names;
mutable std::mutex m_mutex;
bool m_trace_enabled;
};
class ILogOutput {
public:
virtual void logRaw(LogLevel, const std::string &line) = 0;
virtual void log(LogLevel, const std::string &combined,
const std::string &time, const std::string &thread_name,
const std::string &payload_text) = 0;
};
class ICombinedLogOutput : public ILogOutput {
public:
void log(LogLevel lev, const std::string &combined,
const std::string &time, const std::string &thread_name,
const std::string &payload_text)
{
logRaw(lev, combined);
}
};
class StreamLogOutput : public ICombinedLogOutput {
public:
StreamLogOutput(std::ostream &stream) :
m_stream(stream)
{
#if !defined(_WIN32)
is_tty = isatty(fileno(stdout));
#else
is_tty = false;
#endif
}
void logRaw(LogLevel lev, const std::string &line);
private:
std::ostream &m_stream;
bool is_tty;
};
class FileLogOutput : public ICombinedLogOutput {
public:
void setFile(const std::string &filename, s64 file_size_max);
void logRaw(LogLevel lev, const std::string &line)
{
m_stream << line << std::endl;
}
private:
std::ofstream m_stream;
};
class LogOutputBuffer : public ICombinedLogOutput {
public:
LogOutputBuffer(Logger &logger) :
m_logger(logger)
{
updateLogLevel();
};
virtual ~LogOutputBuffer()
{
m_logger.removeOutput(this);
}
void updateLogLevel();
void logRaw(LogLevel lev, const std::string &line);
void clear()
{
m_buffer = std::queue<std::string>();
}
bool empty() const
{
return m_buffer.empty();
}
std::string get()
{
if (empty())
return "";
std::string s = m_buffer.front();
m_buffer.pop();
return s;
}
private:
std::queue<std::string> m_buffer;
Log 7c 3c c0 68 ed 33 bf 2b bb 15 bf 9e 3d cf be 13 a1 86 3e 86 f2 e3 3e 88 de e9 bd 5b b2 b5 | ?.|<.h.3.+....=.....>...>....[.. |
0e20 | 3f ed 41 3a c0 69 6d 34 bf 4e fb 26 bf 1e c5 8e be bb 9e 86 3e c6 b0 e9 3e 24 ce 1e bc c5 54 b5 | ?.A:.im4.N.&........>...>$....T. |
0e40 | 3f f0 41 3a c0 55 7f 2a 3f 62 2d 31 bf 1d 71 8e be 41 d6 95 3e 68 b1 e9 3e 24 ce 1e bc c5 54 b5 | generated by cgit v1.2.3 (git 2.39.1) at 2024-12-25 08:47:58 +0000
|