{"id":1051,"date":"2021-01-22T15:20:00","date_gmt":"2021-01-22T22:20:00","guid":{"rendered":"https:\/\/www.great-white-software.com\/blog\/?p=1051"},"modified":"2021-02-04T08:18:08","modified_gmt":"2021-02-04T15:18:08","slug":"save-yourself-some-time","status":"publish","type":"post","link":"https:\/\/www.great-white-software.com\/blog\/2021\/01\/22\/save-yourself-some-time\/","title":{"rendered":"Save yourself some time"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I see a lot of times people write code like<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#if debugbuild\n   system.debuglog \"some message\"\n#endif<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It means you type multiple lines of code all the time and if you forget to wrap things in the <code>#if debugbuild<\/code> then you have logging messages in your builds that maybe should have been turned off<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Personally I have a module, named Debug, that has a method in it &#8211; Log<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then where ever I want a debugging message I can write<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>debug.log \"some message\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">which is also shorter <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Debug.Log is implemented as (I have other overloads as well)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sub Log(msg as string)\n  #if debugbuild\n    System.Log(System.LogLevelDebug, msg)\n  #endif\nEnd Sub\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This way I  can write my debug.log messages and know that every last one will disappear in a built app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And I type a little bit less as well<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I see a lot of times people write code like It means you type multiple lines of code all the time and if you forget to wrap things in the #if debugbuild then you have logging messages in your builds that maybe should have been turned off Personally I have a module, named Debug, that &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.great-white-software.com\/blog\/2021\/01\/22\/save-yourself-some-time\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Save yourself some time&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1051","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/1051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/comments?post=1051"}],"version-history":[{"count":2,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/1051\/revisions"}],"predecessor-version":[{"id":1081,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/1051\/revisions\/1081"}],"wp:attachment":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/media?parent=1051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/categories?post=1051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/tags?post=1051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}