Commit Graph

30 Commits

Author SHA1 Message Date
SmallJoker f46509d5e2
Remove unused functions reported by cppcheck (#10463)
Run unused functions reported by cppcheck

This change removes a few (but not all) unused functions.
Some unused helper functions were not removed due to their complexity and potential of future use.
2020-10-05 09:07:33 +02:00
SmallJoker 836dd4a1e4
Add chat_log_level setting (#9223)
Log all higher levels in LogOutputBuffer
Move StreamLogOutput::logRaw to source file like LogOutputBuffer::logRaw for compiling speed
2020-05-14 19:26:15 +02:00
HybridDog 36bfc67574 Move debug.txt after it grows too big (#8904)
Before opening the file for writing, its file size is tested. If it exceeds 50 MB, it is moved to debut.txt.1, otherwise the log is appended to the old messages. An old debut.txt.1 is removed if it already exists.
2019-09-07 19:38:54 +02:00
you 540e07e3ef Fix missing warningstream (or similar problem) (#7034)
Use the --color command line parameter instead of a setting for coloured logs

This fixes the missing warningstream bug, g_settings->get mustn't be used there.
Also, the decision about en- or disabling log colours fits better to the command line parameters than minetest settings.
2018-03-04 17:34:36 +01:00
Pedro Gimeno f77f19a941 Fix off-by-one in log output line length (#6896) 2018-01-09 19:07:14 +01:00
ShadowNinja 6c5e5e2023 Remove threads.h and replace its definitions with their C++11 equivalents (#5957)
This also changes threadProc's signature, since C++11 supports arbitrary
thread function signatures.
2017-06-11 09:43:05 +02:00
Ekdohibs c350cfb50b Make logging use a fixed-length buffer to avoid race conditions.
Previously, race conditions occurred inside logging, that caused
segfaults because a thread was trying to use an old pointer that
was freed when the string was reallocated. Using a fixed-length buffer
avoids this, at the cost of cutting too long messages over seveal lines.
2016-04-21 10:15:17 +01:00
est31 5e507c9829 Add server side ncurses terminal
This adds a chat console the server owner can use for administration
or to talk with players.
It runs in its own thread, which makes the user interface immune to
the server's lag, behaving just like a client, except timeout.
As it uses the same console code as the f10 console, things like nick
completion or a scroll buffer basically come for free.
The terminal itself is written in a general way so that adding a
client version later on is just about implementing an interface.

Fatal errors are printed after the console exists and the ncurses
terminal buffer gets cleaned up with endwin(), so that the error still
remains visible.

The server owner can chose their username their entered text will
have in chat and where players can send PMs to.
Once the username is secured with a password to prevent anybody to
take over the server, the owner can execute admin tasks over the
console.

This change includes a contribution by @kahrl who has improved ncurses
library detection.
2015-11-06 08:51:14 +01:00
kwolekr 688556a5d1 Add STATIC_ASSERT() macro and use it 2015-10-27 22:27:32 -04:00
est31 1f76808e4f Fix out of bounds vector write in Logger::addOutput(ILogOutput *out)
Previously, the invocation of Logger::addOutput(ILogOutput *out) led to
an out of bounds write of the m_outputs vector, resulting in the
m_silenced_levels array being modified.

Fortunately, the only caller of that method was android system logging,
and only since a few commits ago.
2015-10-25 00:13:01 +02:00
est31 2f19abd704 Small logging refactor and additional options
-> Get rid of Logger::logToSystem and use normal downstream output system for android instead

-> Give the downstream output system more information: enrich the log function of ILogOutput
	with information and add ICombinedLogOutput for easier use.

-> Make Logger::getLevelLabel() static and public so that it can be used by downstream log output.

-> Add g_ and m_ prefixes where required
2015-10-24 19:59:39 +02:00
kwolekr 6be74d17df Refactor thread utility interface
- Add "thr_" prefix to thread utility functions
- Compare threadid_ts in a portable manner, where possible
2015-10-16 22:20:24 -04:00
ShadowNinja 2139d7d45f Refactor logging
- Add warning log level
- Change debug_log_level setting to enumeration string
- Map Irrlicht log events to MT log events
- Encapsulate log_* functions and global variables into a class, Logger
- Unify dstream with standard logging mechanism
- Unify core.debug() with standard core.log() script API
2015-10-14 01:03:54 -04:00
David Jones 34b7a147dc Change i++ to ++i 2015-08-25 18:33:52 -04:00
ShadowNinja e4bff8be94 Clean up threading
* Rename everything.
    * Strip J prefix.
    * Change UpperCamelCase functions to lowerCamelCase.
  * Remove global (!) semaphore count mutex on OSX.
  * Remove semaphore count getter (unused, unsafe, depended on internal
    API functions on Windows, and used a hack on OSX).
  * Add `Atomic<type>`.
  * Make `Thread` handle thread names.
  * Add support for C++11 multi-threading.
  * Combine pthread and win32 sources.
  * Remove `ThreadStarted` (unused, unneeded).
  * Move some includes from the headers to the sources.
  * Move all of `Event` into its header (allows inlining with no new includes).
  * Make `Event` use `Semaphore` (except on Windows).
  * Move some porting functions into `Thread`.
  * Integrate logging with `Thread`.
  * Add threading test.
2015-08-23 22:04:06 -04:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
Loic Blot 3d505b2b5f Use std::queue for HTTPFetchRequest and std::vector for log_output instead of std::list 2015-03-05 16:21:10 +01:00
Craig Robbins 66efaaa983 Fix Android compile warning 2015-02-12 13:16:38 +10:00
sapier 083d19b3fc Fixes for android
Copy only minetest_game to apk by default
Don't copy .git and .svn folders to apk
Fix bouncing asset copy scrollbar due to long filepaths
Reenable font scaling to fix broken menu on high dpi screens
Implement minetest loglevel to android loglevel mapping
Disable touch digging while moving around
2015-01-06 16:13:39 +01:00
kwolekr 093b1b47d9 Log: Silence errorstream during unittests 2014-12-12 15:51:55 -05:00
sapier 1cc40c0a7c Add support for Android 2.3+
There have been plenty of ppl involved in creating this version.
I don't wanna mention names as I'm sure I'd forget someone so I
just tell where help has been done:
- The partial android versions done by various ppl
- Testing on different android devices
- reviewing code (especially the in core changes)
- testing controls
- reviewing texts

A big thank you to everyone helping this to be completed!
2014-06-29 18:17:56 +02:00
sapier 9edb91da57 Fixed minetest reliable udp implementation (compatible to old clients) 2014-01-10 10:10:45 +01:00
sapier de0cdbc01c Fix log threadname lookup handling not beeing threadsafe 2013-11-30 21:22:15 +01:00
Sfan5 6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam 497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
Perttu Ahola 037b259197 Switch the license to be LGPLv2/later, with small parts still remaining as GPLv2/later, by agreement of major contributors 2012-06-05 18:54:07 +03:00
Perttu Ahola 1f670fc688 Add better trace peudo-loglevel support 2012-05-20 18:30:30 +03:00
Perttu Ahola 013921782b Add a third log output interface method 2011-11-29 19:13:56 +02:00
Perttu Ahola 6e0de7b42c Add log_remove_output and log_deregister_thread 2011-11-29 19:13:55 +02:00
Perttu Ahola 4846846a2d Initially add small and tight logging facility 2011-10-16 12:45:00 +03:00