Very curiously, workaround is EASY.
Hi,
while writing the demo I found that the switch function isn't doing well with udt variables.
Anyway, here is the last version that raise an error at switch keyword.
Eros, do you think it is worth waiting for a fix or to workaround that in the meantime ?
ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64
Very curiously, workaround is EASY.
ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64
Well,
fix_feat_severity is now the latest version.
Every functionality is now working thanks to workarounds. (errors reported)
There is a demo too.
Last edited by DirectuX; 05-01-2020 at 23:07.
ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64
Hi Sebastian,
thanks a lot for the additions. I really appreciate you integrated the changed, thank you!
If I may, few ideas - not requests - just ideas.
When I see line like this:
... I feel a bit anxious - what was the first boolean flag, what second, what third, what fourth? This is why I would recommend to solve situation like this with a single binary mask instead.dim logger as tLogthis(%TRUE, %TRUE, %FALSE, %FALSE)
Also, I noticed that the parameter #1, isDebug, contradicts parameter #4, verbose.
From "code smell" perspective, it is recommended to avoid negative flags. Instead of doNotPrependTag, I would preffer prependTag. This was mentioned in Code Complete, it is a really nice book with lot of good advices.
I would suggest to not overdo it with parameters in constructor, and provide convenient defaults, overridable by methods:
Too much typing? Yes, but you do it once, for setup. Readability? In my opinion much higher than %TRUE, %TRUE, %FALSE, %FALSE.dim logger as tLogthis() logger.showConsole(true) logger.setOutputMode(%LOG_MODE_DEBUG) # or %LOG_MODE_VERBOSE logger.prependTag(false)
Last but not least, I think .logThis could be replaced with .write, it is a bit shorter and does not look too verbose.
Let me know what you think.
Petr
Last edited by Petr Schreiber; 06-01-2020 at 22:38.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Hi Petr,,
Yes ! Thanks !Last but not least, I think .logThis could be replaced with .write, it is a bit shorter and does not look too verbose.
I perfectly agree, but then I have to take time to think how, as I wanted prependTag by optional default. Did you have something in mind ?Instead of doNotPrependTag, I would preffer prependTag
Here again I agree.When I see line like this:
I feel a bit anxious - what was the first boolean flag, what second, what third, what fourth?dim logger as tLogthis(%TRUE, %TRUE, %FALSE, %FALSE)
1/ Not an excuse but it may help understand my bad habit: with VB6, there always was a filtered auto suggest list along typing : so not room for error or questioning parameters.
2/ Did you just suggest what I did for this part ? :
if yes, that's ok and easy (readability part) but'logWhere equates %LT_Debug = 1 as Long 'Display only if isDebug = %TRUE %LT_Time = 2 as Long ' Prepend DateTime$ %LT_ToConsole = 4 as Long %LT_ToConsoleTitle = 8 as Long %LT_ToMsgBox = 16 as Long %LT_ToLogFile= 32 as long %LT_ToStatusBar= 64 as long (...) function logThis(logWhere as long = 0, (...) if Bit_Get(logWhere,1) then
for code writing, it remains the same until we do something for code auto suggestions.
Did I understand your idea ?
ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64
You can make prependTag OPTIONAL, but you can still give the parameter default value via `= true` or `= false`.I perfectly agree, but then I have to take time to think how, as I wanted prependTag by optional default. Did you have something in mind ?
I understand your point with filling parameters, but it still is and issue when reading the codeNot an excuse but it may help understand my bad habit: with VB6, there always was a filtered auto suggest list along typing : so not room for error or questioning parameters.
Yes, but I then changed my mind because of the exclusivity between isDebug and verbose. Please see the edited post.Did you just suggest what I did for this part ?
Thank you,
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Hi,
@Petr, thank you again for your guidance
Master is now again the most up to date version of this Log unit.
To do: documentation, thus code is self explaining ( demo is present ).
ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64
Thank you for the adjustments, Sebastian
It is looking good! I think we have a solid, highly customizable base here.
For quick logging, I would maybe like to have something like:
What do you think?dim logger as tLogThis() logger.SetDefaultLogTarget(%LT_ToMsgBox + %LT_ToConsole) ' If not specified other, these would be used. Stores parameter to me.defaultLogTarget internally logger.SetDefaultTitle("Main") ' If not specified other, this title would be used. Stores parameter to me.defaultTitle internally logger.wInfo("Ciao, Sebastian!") ' Internally calls logger.write(me.defaultLogTarget, "Ciao, Sebastian", me.defaultTitle, %TAG_INFO) logger.wError("Ooops, problem happened") ' Internally calls logger.write(me.defaultLogTarget, "Ooops, problem happened", me.defaultTitle, %TAG_ERROR)
Petr
Last edited by Petr Schreiber; 07-01-2020 at 21:23.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Great idea Petr !
As I'm already on another thinBasic project, I logged the idea and be back soon on this.
ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64
If you can add "thinBasic" word somewhere in https://github.com/DirectuX/logger readme.md it will be found when people search for thinBasic.
Thanks
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks