Comments (12)
Definitely a "service". Anyone, including people using NovelRT
will likely want to add minimal logging support and integrating to the built in stuff is likely ideal.
from novelrt.
Any suggestions?
What would this look like?
from novelrt.
G3log - basic documentation, no dependencies, async (but not atomic ??? weird), linux only crash handling, code only initialization, no log level filtration except if you use a macro which slows down performance quite a bit, no utf-8 support, mediocre performance over all
Spdlog - basic documentation, uses fmt library for message formatting (this is pretty cool feature imo), one of the best performants, but only if you allocate about ~150 megabytes to it (this seems wrong for our purposes, giving engine 150 more megabytes just for logging), header-only library (few of them), async not atomic
Easylogging - single header lib (~6700 lines), better than basic documentation, not picky of cpu, juicy bundle of util macro, cli flags and file configs support, sync - sinks like file can be painful in bad circumstances, no level filtration looks like
Examples
g3log -
int main() {
int less = 1; int more = 2
LOG_IF(INFO, (less<more)) <<"If [true], then this text will be logged";
// or with printf-like syntax
LOGF_IF(INFO, (less<more), "if %d<%d then this text will be logged", less,more);
}
Spdlog -
#include "spdlog/spdlog.h"
#include "spdlog/sinks/basic_file_sink.h"
int main()
{
spdlog::info("Welcome to spdlog!");
spdlog::error("Some error message with arg: {}", 1);
spdlog::warn("Easy padding in numbers like {:08d}", 12);
spdlog::critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42);
spdlog::info("Positional args are {1} {0}..", "too", "supported");
spdlog::set_level(spdlog::level::debug); // Set global log level to debug
}
Easylogging -
#include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP //thread-safe macro
int main(int argc, const char** argv) {
el::Configurations defaultConf;
defaultConf.setToDefault();
// Values are always std::string
defaultConf.set(el::Level::Info,
el::ConfigurationType::Format, "%datetime %level %msg");
// default logger uses default configurations
el::Loggers::reconfigureLogger("default", defaultConf);
LOG(INFO) << "Log using default file";
// To set GLOBAL configurations you may use
defaultConf.setGlobally(
el::ConfigurationType::Format, "%date %msg");
el::Loggers::reconfigureLogger("default", defaultConf);
return 0;
}
I suggest using spdlog, it's pretty fast, easy to read and overall a good choice. If everyone agrees on it then I'm going to add logging to novelrt.
from novelrt.
Please note whatever logging framework we use MUST be available via vcpkg.
from novelrt.
For reference: available logging platforms via vcpkg
from novelrt.
What would you prefer?
from novelrt.
Well, from searches for benchmarks I've done, it appears that top 3 are glog, g3log, and spdlog.
Arkrait pretty much hit the nail on the head with the latter two, with glog being the predecessor to g3log - APIs are very similar, but glog is synchronous. Also, since it uses macros, there may be a slight issue if we ever need to pull in a Windows dependency (it defines ERROR
, which <windows.h>
does as well).
Overall, I think spdlog is the best choice. I'm not quite sure about the allocation issue as mentioned before, but I feel it would be best for our needs. Sounds good?
from novelrt.
LGTM, let's do it.
from novelrt.
So, to recap:
-Spdlog will be logging framework of choice.
-In this there will be a DEBUG
flag established
-All cout
and cerr
calls will be replaced
from novelrt.
Yep that sounds right.
from novelrt.
Sounds silly, but last question - would we want to create a service for this? Or just effectively replace the standard calls for now?
from novelrt.
Thanks for the clarification! That's the route I wanted to head, but I just wanted to be sure.
from novelrt.
Related Issues (20)
- Install Vulkan SDK CI command stalls GH Actions occasionally
- Replace reinterpret_cast with `NovelRT::Utilities::Misc::BitCast` where appropriate
- Introduce Universal Binaries for macOS
- C API needs casing fixed for function names HOT 3
- Nrt_Event needs unit tests to ensure functionality HOT 3
- CMake Dependency needs updating due to use of VS 2022 Generator HOT 1
- Doxygen generation appears to be wrong for some definitions. HOT 3
- Add switch to enable C++ 20 compilation
- Create a plugin interface for physics HOT 2
- Consider migrating all `Try` methods to return `std::optional<T>` instead of `bool` with some kind of out `T&`. HOT 2
- Vulkan causes an exception to be thrown when receiving VK_ERROR_OUT_OF_DATE_KHR with X11.
- Getting an error during the building process HOT 11
- Readme doesn't list Python HOT 1
- Input resets from KeyDownHeld to Idle on each frame
- Inconsistent NovelRT.h dependency HOT 1
- [GHA] Clang-format does not seem to agree with local clang-format.
- Inline functions cause cyclic dependencies
- Need to add Controller support for input
- If you create a NovelRT::Ecs::SystemScheduler as a variable which is then later initialised, this causes a crash HOT 1
- spdlog causes build issues on latest VS2022
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from novelrt.