-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging utilities #12
Comments
@kotcrab Anything else? We could add custom |
Well this is a wrapper over libGDX API, I don't think we should add custom levels. I would expect a way to customize output message, eg. prepend time or date, otherwise people will probably still create their own wrappers, and maybe add some control to disable log levels (e.g. only show error messages). |
The thing is - since I might create another Log level disabling is handled by the LibGDX itself. You can globally turn on and off the levels that you do or do not need. |
Message formatting can be simply achieved as changeable global method. //logger file
var formatLogMessage: (String) -> String = { it }
//app class
fun myAppInit() {
formatLogMessage = { getTimestamp() + it }
} The same could be done for default log level tags, although I'm not sure if that would be good practice or not. |
Adds the overhead of calling another method ( Imho a complex, customizable logger (that still uses inlining) would be a more lightweight solution, although it could be a pain to refactor your application to switch from one to the other. I have to think about it. |
I really wanted to go for simplicity and as little overhead as possible. Customized logging functions could easily introduce concurrency bugs when done wrong. Instead of refactoring current logging mechanism, I decided to make it possible to extend Anyway, I'm guessing most people will be fine with the usual |
Logger
implementation.Thanks to
inline
functions, Kotlin can make it possible to use nearly-zero overhead logging mechanism that does not rely on varargs to provide string templates. The existing solution is - unfortunately - not compatible with LibGDX logging.The text was updated successfully, but these errors were encountered: