-
Notifications
You must be signed in to change notification settings - Fork 87
Feat: Added a simple logger implementation #1777
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
base: master
Are you sure you want to change the base?
Conversation
Just to ask what your goal is: are you aware of Dev() with its log levels? |
Wait something like that exists? |
TTT2/lua/ttt2/libraries/none.lua Line 70 in 2b5d2e7
|
Thats good to know, so the logger is basically not needed or would that be something thats interesting? |
I think I personally don't need it - but what was your motivator when developing this module? Do you need it? Does the Dev() function satisfy your requirements? |
Generally I wanted to create a logger where I can add multiple log levels and be able to toggle them on/off. Then I went in the direction of: This would be nice to have for every addon, just having a simple logger where you can either create a logger or add your own log levels. Overall Dev() does not 100% solve the issue I personally had because I cant change individual log levels and things like that |
With Dev being a thing id tend to not add this additional logger implementation. Lets keep this simple for now. But thanks for the high quality PR 🫶 |
Maybe dev can be expanded by what you wanted to add here? |
While i agree that The most prominent problem i have with this is that
Further i can't really see an Additionally with the currently proposed 'blanket' implementation with unlimited log levels you also overload addon devs with decisions to make:
While i'm opposed to the currently proposed implementation, i would be open to a different implementation with static log levels and more defined traits.
What do you think? Would an implementation like the one i outlined above be something you'd be interested in? [1] https://wiki.facepunch.com/gmod/Global.error(lowercase) [2] https://wiki.facepunch.com/gmod/Global.ErrorNoHalt [3] 4e1156a#diff-ba99f6bc4916e6a08593f9f6829511757f30cf221e543a01bf5556533c50cc89R92-R113 |
That sounds like a good Idea, overall this should make logging easier as using simple prints is quite annoying to use, especially when you want to also include things like the name of the addon For example I didnt know If I have the time I will take a look how to implement a better logging approach with the things described above |
With this I want to make it nicer for Addon devs to include logging
Every instance of the logger can contain log levels which can be toggled on/off independantly of each other.
This should result in addons being able to create theyre own logger and just being able to call self defined methods.
Some things that probably should be added are: