{"id":57643,"date":"2023-07-24T16:20:23","date_gmt":"2023-07-24T10:50:23","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=57643"},"modified":"2023-08-01T16:21:30","modified_gmt":"2023-08-01T10:51:30","slug":"debugging-with-bright-script-logger","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/debugging-with-bright-script-logger\/","title":{"rendered":"Debugging with Bright Script Logger"},"content":{"rendered":"<p class=\"western\"><span lang=\"en-US\">Logs are always very useful for software developers. It helps developers identify the problems &amp; issues with their programs. Logs help them print data on the console &amp; debug their code.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-57640 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/06\/BSLogs-1024x615.png\" alt=\"\" width=\"625\" height=\"375\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/06\/BSLogs-1024x615.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/BSLogs-300x180.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/BSLogs-768x461.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/BSLogs-1536x923.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/BSLogs-2048x1230.png 2048w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/BSLogs-624x375.png 624w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<h2 class=\"western\"><span lang=\"en-US\"><b>Are logs really that easy to use<\/b><\/span><span lang=\"en-US\">\u00a0<\/span><\/h2>\n<p class=\"western\"><span lang=\"en-US\">Logs seem pretty much handy, but there are some problems too with logs, and one of the biggest problems developers face with logs is that logs make your apps slow &amp; heavy in size. It usually happens when you use too many logs and keep them alive in production.\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-57641 aligncenter\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/06\/Loading1-300x283.jpeg\" alt=\"\" width=\"300\" height=\"283\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/06\/Loading1-300x283.jpeg 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Loading1-768x723.jpeg 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Loading1-624x588.jpeg 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Loading1-24x24.jpeg 24w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Loading1.jpeg 1000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p class=\"western\"><span lang=\"en-US\">Logs can(if not used properly): <\/span><\/p>\n<ul>\n<li>\n<p class=\"western\"><span lang=\"en-US\">Degrade the performance of your application.<\/span><\/p>\n<\/li>\n<li>\n<p class=\"western\"><span lang=\"en-US\">Make your app heavier in size.<\/span><\/p>\n<\/li>\n<li>\n<p class=\"western\"><span lang=\"en-US\">Make you go here and there in your code to identify any specific log\/print statement. <\/span><\/p>\n<\/li>\n<\/ul>\n<p class=\"western\"><span lang=\"en-US\">Developers usually remove logs from their code but it&#8217;s actually a time taking &amp; complex process. Because it has to be done manually by browsing every single file. Bright Script Loggers come to the rescue here.<\/span><\/p>\n<h2 class=\"western\"><span lang=\"en-US\"><b>What is a BS Logger<\/b><\/span><\/h2>\n<p class=\"western\"><span lang=\"en-US\">Instead of writing logs in every single file, you can put all your logs in a single file only, and those logs are wrapped by functions\/subs. This file can be included in any of your other files, and methods written in logger file can be called easily from anywhere in your application. So a Bright Script Logger is just a .brs file containing some methods that log your data. You can put any no of methods in this logger file. Here&#8217;s a demo. <\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-57642 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/06\/Screenshot-2023-06-15-at-3.47.54-PM-1024x413.png\" alt=\"\" width=\"625\" height=\"252\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/06\/Screenshot-2023-06-15-at-3.47.54-PM-1024x413.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Screenshot-2023-06-15-at-3.47.54-PM-300x121.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Screenshot-2023-06-15-at-3.47.54-PM-768x310.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Screenshot-2023-06-15-at-3.47.54-PM-1536x620.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Screenshot-2023-06-15-at-3.47.54-PM-624x252.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/06\/Screenshot-2023-06-15-at-3.47.54-PM.png 1660w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<h2 class=\"western\"><span lang=\"en-US\"><b>Benefits of using BS Loggers<\/b><\/span><\/h2>\n<p class=\"western\"><span lang=\"en-US\">Loggers have got following advantages over using logs in different files in your application:<\/span><\/p>\n<ul>\n<li><span lang=\"en-US\">You&#8217;ve got a single file only to put &amp; look around your logs in your app. <\/span><\/li>\n<li><span lang=\"en-US\">Loggers are accessible anywhere in your project.<\/span><\/li>\n<li><span lang=\"en-US\">Loggers eliminate your problem of removing logs from your application before releasing your app to production. You can simply comment your few methods written in Logger. <\/span><\/li>\n<li><span lang=\"en-US\">Loggers are pretty easy to use and require less code to execute. <\/span><\/li>\n<\/ul>\n<p class=\"western\"><span lang=\"en-US\"><b>Conclusion<\/b><\/span><span lang=\"en-US\">: So, looking at the discussion we had above, we can state that Loggers have come up with very good advantages and it&#8217;s a powerful tool to look around your code. It actually allows you to debug your code in a better way and off course, it is time saving and easy to use.<\/span><\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Logs are always very useful for software developers. It helps developers identify the problems &amp; issues with their programs. Logs help them print data on the console &amp; debug their code. Are logs really that easy to use\u00a0 Logs seem pretty much handy, but there are some problems too with logs, and one of the [&hellip;]<\/p>\n","protected":false},"author":637,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":28},"categories":[3479,3477,1994],"tags":[4479,1404,3116,3474,3629],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57643"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/637"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=57643"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57643\/revisions"}],"predecessor-version":[{"id":57875,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57643\/revisions\/57875"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=57643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=57643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=57643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}