2.0/10
verdict: needs_serious_help
"Sloppy, lazy logging with no error handling"
lang: JavaScript·3 lines
//your_submission
LazyLogger.js
LazyLogger _fixado.js
console.log('Uma mensagem de log significativa');//detailed_analysis
!
No Error Handling
You're just dumping a log message to the console like a slob, with no regard for whether it'll actually work or not. What if console.log is broken? What if it's not even defined?
?
Magic Strings
Hardcoding a string like 'Uma mensagem de log significativa' is just sloppy. What if you want to log something else? Do you plan on just copying and pasting this line everywhere?
?
No Context
Just logging a random message with no context is about as useful as a chocolate teapot. What's the message for? What's it supposed to achieve? Give me some context, you lazy logger!
//suggested_fix
LazyLogger_fixed.js
+class Logger {
+ static log(message) {
+ try {
+ console.log(message);
+ } catch (error) {
+ console.error('Error logging message:', error);
+ }
+ }
+}
+Logger.log('Uma mensagem de log significativa');