02.03.2017, 22:52
(
Последний раз редактировалось TheRealSphinx; 09.05.2017 в 20:55.
Причина: New version available v0.0.3-alpha
)
Hello guys,
currently I'm refactoring my plugin and started moving some stuff to a new plugin.
I made this plugin before and I thought I can share it with you guys.
This plugin provides an API for gabime/spdlog.
With that plugin your logs doesnt block on write. You can easily write some stuff asynchronous.
Flush policies
By default spdlog lets the the underlying libc flush whenever it sees fit to achieve good performance. You can override this using the following options:
- Manual flush: LogFlush(const name[]) (See the example below)
- Flush on log level: LogFlushOn(const name[], SPDLOG_LEVEL:level)
Example ConsoleLogger
Manual flush (BasicLogger)
You can manually flush the log using the LogFlush function.
Don't use the example code, please change the defines to variables to lower the memory ussage.
The source code is hosted on github.
- Sphinxila/samp-plugin-spdlog
Download:
- Download Linux: Download v.1.0.0
- Download Windows: Download v.1.0.0
Support:
If you have some bugs, feel free to share that on github as an issue: Klick
The chance that I see some bug reports here are very low cause I'm not very active at this board (forum).
Kind regards
Sphinx (ProMetheus)
currently I'm refactoring my plugin and started moving some stuff to a new plugin.
I made this plugin before and I thought I can share it with you guys.
This plugin provides an API for gabime/spdlog.
With that plugin your logs doesnt block on write. You can easily write some stuff asynchronous.
Flush policies
By default spdlog lets the the underlying libc flush whenever it sees fit to achieve good performance. You can override this using the following options:
- Manual flush: LogFlush(const name[]) (See the example below)
- Flush on log level: LogFlushOn(const name[], SPDLOG_LEVEL:level)
Example ConsoleLogger
Код:
#include <a_spdlog> #define Console "stdout" public OnGameModeInit() { // Enable async logging LoggerSetAsyncMode(4096); // Initialize logger ConsoleLogger(Console); // To console (no log) // Info (This text doesnt show up in server_log.txt) LogInfo(Console, "Gamemode initializing..."); // Don't use these lines if it's a filterscript SetGameModeText("SPDLog Test"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); // Info (This text doesnt show up in server_log.txt) LogInfo(Console, "Gamemode initialized..."); LogInfo(Console, "Server started or whateverr..."); LogCritical(Console, "The server is burning! <- Colored console in samp 'WOW'"); return 1; }
You can manually flush the log using the LogFlush function.
Код:
#include <a_spdlog> #define Log "stdlog" public OnGameModeInit() { // Enable async logging LoggerSetAsyncMode(4096); // Initialize logger BasicLogger(Log, "test.log"); // To console (no log) // Info (This text doesnt show up in server_log.txt) LogInfo(Log, "Gamemode initializing..."); LogFlush(Log); // Don't use these lines if it's a filterscript SetGameModeText("SPDLog Test"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); // Info (This text doesnt show up in server_log.txt) LogInfo(Log, "Gamemode initialized..."); LogInfo(Log, "Server started or whateverr..."); // Flush LogFlush(Log); return 1; }
The source code is hosted on github.
- Sphinxila/samp-plugin-spdlog
Download:
- Download Linux: Download v.1.0.0
- Download Windows: Download v.1.0.0
Support:
If you have some bugs, feel free to share that on github as an issue: Klick
The chance that I see some bug reports here are very low cause I'm not very active at this board (forum).
Kind regards
Sphinx (ProMetheus)