README.md in delogger-0.3.0.alpha2 vs README.md in delogger-0.3.0.alpha3

- old
+ new

@@ -2,10 +2,12 @@ # Delogger This gem is a simple wrapper for the browser's console. It can be turned off both globally (e.x. production environment) and locally. It also supports CSS formatting. + + ![Demo](/images/demo.png?raw=true) ## Getting Started ### Rails: @@ -37,18 +39,40 @@ logger = new DeLogger ``` See also: [options](#options). By default, DeLogger is **disabled on the client side**. To enable it, use `logger.enable()` in your -console. You can disable it again using `logger.disable()`. +console. You can disable it again using `logger.disable()`. DeLogger is using browser's `localStorage`, +so you only have to enable/disable it once on your website. DeLogger supports same output methods as console: -- `log`, `debug`: ![debug][/images/debug.png?raw=true] -- `info`: ![info][/images/info.png?raw=true] -- `warn`: ![warn][/images/warn.png?raw=true] -- `error`: ![error][/images/error.png?raw=true] +- `log`, `debug`: +![debug][/images/debug.png?raw=true] +- `info`: +![info][/images/info.png?raw=true] +- `warn`: +![warn][/images/warn.png?raw=true] +- `error`: +![error][/images/error.png?raw=true] +### Options + +You can pass options to DeLogger upon initialization: +```js +logger = DeLogger.new({ disabled: false, formatStrings: true }) +``` +- `disabled`: You can disable the logger globally if you want to. Normally, though, `logger.disable()` +should be enough. +- `formatStrings`: Controls whether strings should be formatted (see [formatting](#formatting)) or +left unchanged. + +### Focus mode + +If you want to debug a certain block of code, but your console is flooded with messages, you can +enter the Focus mode with `logger.focus()`. In this mode, you will only see "focused" output. To +produce "focused" output, use `logger.focus('my text')`. To leave Focus mode, use `logger.unfocus()`. + ## Formatting DeLogger supports string formatting. Syntax: `"(my text).class1.class2"`. Supported classes: `badge`, `bold`, `italic`. See also: [color classes](#color-classes). @@ -57,10 +81,10 @@ ```js logger.log("(MyClass#myMethod).badge.italic (@akxcv).badge.orange (bold).bold", { foo: 'bar' }) ``` ![Example output](/images/formatting.png?raw=true) -## Color classes +### Color classes DeLogger supports following color classes (both for badges and normal text): - `.blue` - `.orange` - `.red`