{"id":622,"date":"2020-01-08T12:09:12","date_gmt":"2020-01-08T12:09:12","guid":{"rendered":"https:\/\/sdf-docs.mansystems.com\/docs\/acr-rules\/maintenance\/log-nodes-should-not-be-hard-coded\/"},"modified":"2020-02-24T11:45:04","modified_gmt":"2020-02-24T11:45:04","slug":"badlognode","status":"publish","type":"docs","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/maintainability\/badlognode","title":{"rendered":"Log message nodes should be consistent"},"content":{"rendered":"\n<p>Non-constant (dynamic\/hard-coded) log nodes are more difficult to track in case of an error. The same module can use different log nodes due to typo\u2019s, different developers, etc.<\/p>\n\n\n\n<p>The recommendation is to use constants or enums.  However, if a string literal is used then it should be consistently used in the app. In other words, if a string literal is only used in a single log message this message will be very hard to track in the log files.<\/p>\n\n\n\n<p><code>@Example.ImportantLogNode<\/code><br><code>getKey(Example.LogNode_Enum.ImportantLogNode)<\/code><\/p>\n\n\n\n<p><strong>Noncompliant example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"231\" src=\"https:\/\/sdf-docs.clevr.com\/wp-content\/uploads\/2020\/01\/image-71.png\" alt=\"\" class=\"wp-image-1029\" srcset=\"https:\/\/sdf-docs.clevr.com\/wp-content\/uploads\/2020\/01\/image-71.png 472w, https:\/\/sdf-docs.clevr.com\/wp-content\/uploads\/2020\/01\/image-71-300x147.png 300w\" sizes=\"(max-width: 472px) 100vw, 472px\" \/><\/figure>\n\n\n\n<p><strong>Compliant example:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"514\" height=\"227\" src=\"https:\/\/sdf-docs.clevr.com\/wp-content\/uploads\/2020\/01\/image-72.png\" alt=\"\" class=\"wp-image-1030\" srcset=\"https:\/\/sdf-docs.clevr.com\/wp-content\/uploads\/2020\/01\/image-72.png 514w, https:\/\/sdf-docs.clevr.com\/wp-content\/uploads\/2020\/01\/image-72-480x212.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 514px, 100vw\" \/><\/figure>\n","protected":false},"featured_media":0,"parent":98,"menu_order":14,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-622","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/622"}],"collection":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=622"}],"version-history":[{"count":5,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/622\/revisions"}],"predecessor-version":[{"id":1197,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/622\/revisions\/1197"}],"up":[{"embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/98"}],"next":[{"title":"Microflows should be simple or be documented","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/maintainability\/mansystemscomplexityminor","href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/1198"}],"prev":[{"title":"Exclusive split should have a descriptive caption","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/maintainability\/splitcaption","href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/341"}],"wp:attachment":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=622"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}