Sorry for all my mental breakdowns.. Here is some actual progress that I did by myself.. I learnt about Assert from my last code.. And why do we need assert.. And I made my own Logger..
What are these so let me explain..
A Logger is atmost just a console.log message, but why to make it a separate class? This offers a lot of usability, as first, you can just say, this is a warning type of stuff, or this is just verbose.. Or MAYBE STOP SOMETHING IF IT IS SOMETHING VERY FATAL, AND SHOULD BE FIXED ASAP..
Not only that, often you will encounter like specially if you link something like a canvas, it might always be that well, Either you will force it using “!” in the end, or you will just do a command that eliminated undefined.. Like if (canvas !== undefined), but assert says.. OK, LET ME HAVE A CONDITION, and not only that, my asserts are special, as I have rigged it, so it will never ever return or what Typescript called a never return.. So you don’t need to write those..
Loggers also have a special use, as if the messages are verbose, instead of removing and readding all the console logs in like a stupid way.. You can declare a class and say, if the level is below fatal, like for verbose or info type of stuff, just cancel those stuff.. Just don’t show it.. It is very nice tool tbh..
Oh yah, I forgot.. Well, as these are custom, so You can literally add another parameter like context, as to what might be the reason for the breaking of the code, so if you check that code later on in life.. You will still know, what broke and where.. It’s a really handy tool in my opinion and everyone should give it a shot.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.