README.md in delogger-0.2.1 vs README.md in delogger-0.3.0.alpha1

- old
+ new

@@ -1,68 +1,66 @@ [![Gem Version](https://badge.fury.io/rb/delogger.svg)](https://badge.fury.io/rb/delogger) # Delogger -Make your browser console beautiful. This gem is a work in progress. +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) -## Installation +## Getting Started -Add this line to your application's Gemfile: +### Rails: +Add the gem to your Gemfile: ```ruby gem 'delogger' ``` -And then execute: - - $ bundle - -Or install it yourself as: - - $ gem install delogger - Add this to your `application.js`: ``` //= require delogger ``` And `application.css`: ``` *= require delogger ``` -## Usage +### Without Rails: -These methods work similarly to `console.log`, but they support [formatting](#formatting): -- `DeLogger.debug` -- `DeLogger.warn` -- `DeLogger.error` +Include `vendor/assets/javascripts/delogger.js` and `vendor/assets/stylesheets/delogger.css` into +your application. -By default, DeLogger is **disabled**. To enable it, use `DeLogger.enable()`. You can disable it again -using `DeLogger.disable()`. +## Usage -## Logging levels +First, DeLogger has to be initialized: +```js +logger = new DeLogger +``` +See also: [options](#options). -DeLogger has three logging levels: `debug`, `warn` and `error`. Level can be set using `DeLogger.level` -(default is `debug`). (TODO) +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()`. +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] + ## Formatting -DeLogger supports string formatting. Syntax: `"(my text).class1.class2"`. Classes are specific for -the logger and are not being fetched from stylesheets. -Supported classes: `badge`, `debug`, `warn`, `error`, `bold`, `italic`. +DeLogger supports string formatting. Syntax: `"(my text).class1.class2"`. +Supported classes: `badge`, `bold`, `italic`. See also: [color classes](#color-classes). Example: ```js -DeLogger.log("(MyClass#myMethod).badge", "(@akxcv).badge.warn", "(bold).bold", { foo: 'bar' }) +logger.log("(MyClass#myMethod).badge.italic (@akxcv).badge.orange (bold).bold", { foo: 'bar' }) ``` -![Example output](/images/example.png?raw=true) +![Example output](/images/formatting.png?raw=true) -TODO - ## Color classes DeLogger supports following color classes (both for badges and normal text): - `.blue` - `.orange` @@ -82,15 +80,14 @@ At the moment, only these attributes are supported: `margin-left`, `color`, `background-color`, `border-radius`, `padding`, `font-weight`, `font-style`. ## Development -TODO +Modify files in the `assets` folder, compile them afterwards using `./bin/compile`. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/akxcv/delogger. - ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).