Comments (6)
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 Logger
with customized tags - an example of logger that includes current time was added to the README
file.
Anyway, I'm guessing most people will be fine with the usual Logger
and static logging methods (as they are already more flexible and efficient than the usual LibGDX logging), and others can easily modify the way their logs are displayed.
from ktx.
@kotcrab Anything else? We could add custom trace
/warn
levels that work on top of LibGDX debug
and info
/error
, but I'm not sure if that's necessary (especially since we would likely have to introduce new logging level variables).
from ktx.
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).
from ktx.
The thing is - since Logger
methods are inlined, I'm not sure if an interface or complex logging logic would work in this case. We're going for minimal overhead, after all.
I might create another Logger
implementation that adds dates before/after the logging tag, but I'm not sure if full control over log structure is easily achievable.
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.
from ktx.
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.
from ktx.
Adds the overhead of calling another method (formatLogMessage
), even if you don't want an alternate formatting. Doesn't really matter that much, as logs are usually more important for development time, but still.
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.
from ktx.
Related Issues (20)
- Update to Kotlin 1.8.0
- Release KTX 1.11.0-rc4 HOT 1
- AssetStorage fails to load assets on older Android devices due to unsupported ConcurrentHashMap APIs usage HOT 1
- Update to Kotlin 1.8.10
- Release KTX 1.11.0-rc5
- gdxAI module HOT 1
- Update core dependencies
- Release KTX 1.11.0-rc6
- Update to libGDX 1.12.0
- Release KTX 1.12.0-rc1
- Update to Kotlin 1.9.0
- Build error for android in ktx-sample-project HOT 1
- Update libGDX to 1.12.1
- Update Kotlin to 1.9.20
- Update to VisUI 1.5.3
- Utilities for Vector4
- Release KTX 1.12.1-rc1
- KTX pool's discard logic is inconsistent with the original Pool.discard(T) HOT 2
- Update Kotlin to 1.9.22
- Question about new additions HOT 4
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 ktx.