{"id":6159,"date":"2013-03-27T16:11:46","date_gmt":"2013-03-27T23:11:46","guid":{"rendered":"http:\/\/blog.mozilla.org\/addons\/?p=6159"},"modified":"2013-03-27T16:11:46","modified_gmt":"2013-03-27T23:11:46","slug":"changes-to-console-log-behaviour-in-sdk-1-14","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/","title":{"rendered":"Changes to console.log behaviour in SDK 1.14"},"content":{"rendered":"<p>One change in SDK 1.14 that has <a href=\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/26\/announcing-add-on-sdk-1-14\/comment-page-1\/#comment-162765\" target=\"_blank\">already surprised some people<\/a> in the community is a change in the visibility of messages printed from <a href=\"https:\/\/addons.mozilla.org\/en-US\/developers\/docs\/sdk\/1.14\/dev-guide\/tutorials\/logging.html\">console.log<\/a>.<\/p>\n<p>In 1.14 we added some additional features to the console API and also set the default log level to &#8220;error&#8221; instead of &#8220;info&#8221; for add-ons installed into Firefox via the Add-on Manager and Add-on Builder Helper as well as tools like the <a href=\"https:\/\/addons.mozilla.org\/en-US\/firefox\/addon\/autoinstaller\/\" target=\"_blank\">Extension Auto-installer<\/a>.<\/p>\n<p>An unfortunate side-effect is that\u00a0by default, developers using these tools will no longer see messages from <code>console.log()<\/code> in the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Error_Console\">jsconsole window<\/a>.<\/p>\n<p>We have provided the ability for developers to set preferences to control logging behavior both globally and for a specific add-on, and by setting one of these preferences you can override the default.<\/p>\n<h3>Logging levels<\/h3>\n<p>The <a href=\"https:\/\/addons.mozilla.org\/en-US\/developers\/docs\/sdk\/1.14\/dev-guide\/console.html\">console module<\/a> now defines a range of logging levels:<\/p>\n<ol>\n<li><strong>all<\/strong>: log calls to any <code>console<\/code> method<\/li>\n<li><strong>debug<\/strong>: log calls to <code>debug()<\/code>, <code>log()<\/code>, <code>info()<\/code>, <code>warn()<\/code>, <code>error()<\/code><\/li>\n<li><strong>info<\/strong>: log calls to <code>log()<\/code>, <code>info()<\/code>, <code>warn()<\/code>, <code>error()<\/code><\/li>\n<li><strong>warn<\/strong>: log calls to <code>warn()<\/code> and <code>error()<\/code><\/li>\n<li><strong>error<\/strong>: log calls to <code>error()<\/code><\/li>\n<li><strong>off<\/strong>: log nothing<\/li>\n<\/ol>\n<h3>New Preferences<\/h3>\n<p>We have defined two new preferences, which set the logging level either globally for all SDK add-ons, or for a specific SDK add-on:<\/p>\n<p><strong><em>extensions.sdk.console.logLevel<\/em><\/strong>: this preference can be added to about:config to change the logging level of <em>all<\/em> installed SDK-based add-ons.<\/p>\n<p><strong><em>extensions.[extension-id].sdk.console.logLevel<\/em><\/strong>: this preference can be added to about:config to change the logging level of a specific add-on. This preference overrides the global preference.<\/p>\n<p>The value for each preference is the desired logging level, given as a string. If neither preference is set, the logging level defaults to &#8220;error&#8221;.<\/p>\n<h3>Restoring the old behavior<\/h3>\n<p>If you want to restore the previous behavior in which console.log messages are visible in the error log, please do the following:<\/p>\n<ol>\n<li>open about:config<\/li>\n<li>right-click and select New -&gt; String<\/li>\n<li>for the preference name, enter &#8216;extensions.sdk.console.logLevel&#8217;<\/li>\n<li>for the preference value, enter &#8216;all&#8217;<\/li>\n<li>restart Firefox<\/li>\n<\/ol>\n<p>Here is a screenshot of what the result should look like:<\/p>\n<p><a href=\"http:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-6160\" alt=\"about_config\" src=\"http:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png\" width=\"640\" height=\"512\" srcset=\"https:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png 640w, https:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config-252x201.png 252w, https:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config-620x496.png 620w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One change in SDK 1.14 that has already surprised some people in the community is a change in the visibility of messages printed from console.log. In 1.14 we added some &hellip; <a class=\"go\" href=\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/\">Read more<\/a><\/p>\n","protected":false},"author":316,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7117,44,121,588,742],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Changes to console.log behaviour in SDK 1.14 - Mozilla Add-ons Community Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Griffiths\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/\",\"name\":\"Changes to console.log behaviour in SDK 1.14 - Mozilla Add-ons Community Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png\",\"datePublished\":\"2013-03-27T23:11:46+00:00\",\"dateModified\":\"2013-03-27T23:11:46+00:00\",\"author\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/e2f4c71eb45392ea29162432c3f1d433\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#primaryimage\",\"url\":\"http:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png\",\"contentUrl\":\"http:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.mozilla.org\/addons\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Changes to console.log behaviour in SDK 1.14\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#website\",\"url\":\"https:\/\/blog.mozilla.org\/addons\/\",\"name\":\"Mozilla Add-ons Community Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.mozilla.org\/addons\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/e2f4c71eb45392ea29162432c3f1d433\",\"name\":\"Jeff Griffiths\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b07ae75dd1a5414bf30d7f773ccfc894?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b07ae75dd1a5414bf30d7f773ccfc894?s=96&d=mm&r=g\",\"caption\":\"Jeff Griffiths\"},\"description\":\"Jeff is Product Manager for the Firefox Developer Tools and occasional Open Web hacker, based in Vancouver, BC.\",\"sameAs\":[\"http:\/\/canuckistani.ca\/\",\"https:\/\/x.com\/canuckistani\"],\"url\":\"https:\/\/blog.mozilla.org\/addons\/author\/jgriffithsmozilla-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Changes to console.log behaviour in SDK 1.14 - Mozilla Add-ons Community Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/","twitter_misc":{"Written by":"Jeff Griffiths","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/","url":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/","name":"Changes to console.log behaviour in SDK 1.14 - Mozilla Add-ons Community Blog","isPartOf":{"@id":"https:\/\/blog.mozilla.org\/addons\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#primaryimage"},"image":{"@id":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#primaryimage"},"thumbnailUrl":"http:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png","datePublished":"2013-03-27T23:11:46+00:00","dateModified":"2013-03-27T23:11:46+00:00","author":{"@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/e2f4c71eb45392ea29162432c3f1d433"},"breadcrumb":{"@id":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#primaryimage","url":"http:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png","contentUrl":"http:\/\/blog.mozilla.org\/addons\/files\/2013\/03\/about_config.png"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.mozilla.org\/addons\/2013\/03\/27\/changes-to-console-log-behaviour-in-sdk-1-14\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.mozilla.org\/addons\/"},{"@type":"ListItem","position":2,"name":"Changes to console.log behaviour in SDK 1.14"}]},{"@type":"WebSite","@id":"https:\/\/blog.mozilla.org\/addons\/#website","url":"https:\/\/blog.mozilla.org\/addons\/","name":"Mozilla Add-ons Community Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.mozilla.org\/addons\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/e2f4c71eb45392ea29162432c3f1d433","name":"Jeff Griffiths","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.mozilla.org\/addons\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b07ae75dd1a5414bf30d7f773ccfc894?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b07ae75dd1a5414bf30d7f773ccfc894?s=96&d=mm&r=g","caption":"Jeff Griffiths"},"description":"Jeff is Product Manager for the Firefox Developer Tools and occasional Open Web hacker, based in Vancouver, BC.","sameAs":["http:\/\/canuckistani.ca\/","https:\/\/x.com\/canuckistani"],"url":"https:\/\/blog.mozilla.org\/addons\/author\/jgriffithsmozilla-com\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/6159"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/users\/316"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/comments?post=6159"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/posts\/6159\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/media?parent=6159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/categories?post=6159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/addons\/wp-json\/wp\/v2\/tags?post=6159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}