Skip to content

Commit

Permalink
completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Mar 14, 2015
1 parent 1c12565 commit 5b73e9e
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 7 deletions.
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# acho

<h1 align="center">
<br>
<img src="http://i.imgur.com/XtTjX8G.png" alt="acho">
<br>
<br>
</h1>

[![Build Status](http://img.shields.io/travis/Kikobeats/acho/master.svg?style=flat)](https://travis-ci.org/Kikobeats/acho)
[![Dependency status](http://img.shields.io/david/Kikobeats/acho.svg?style=flat)](https://david-dm.org/Kikobeats/acho)
[![Dev Dependencies Status](http://img.shields.io/david/dev/Kikobeats/acho.svg?style=flat)](https://david-dm.org/Kikobeats/acho#info=devDependencies)
[![NPM Status](http://img.shields.io/npm/dm/acho.svg?style=flat)](https://www.npmjs.org/package/acho)
[![Gittip](http://img.shields.io/gittip/Kikobeats.svg?style=flat)](https://www.gittip.com/Kikobeats/)

> A extremely (but powerful) logging system for NodeJS and browser.
> A extremely (but powerful) simple logging system for NodeJS and browser.
# Why

Expand Down Expand Up @@ -152,6 +159,56 @@ You can change how to output the message in the constructor or in any time.

## API

### .constructor({Object} [options])

Create a new logger. The options that you can provide are:

- color **{Boolean}**: If you can colorize the otuput. `false` by default.
- level **{String}**: Stablish the logging level. `info` by default.
- types **{Object}**: You can provide the types and priorities.
- outputType **{Function}**: For customize the type in the output.
- outputMessage **{Function}**: For customize the message in the output.

### .push({String} &lt;type&gt;, {String} &lt;message&gt;)

Store internally a `type` message.

### .add({String} &lt;type&gt;, {String} &lt;message&gt;)

Store internally a `type` message and also output it.

### .error({String} &lt;message&gt;)

Output a `error` message.

### .warning({String} &lt;message&gt;)

Output a `warning` message.

### .success({String} &lt;message&gt;)

Output a `success` message.

### .info({String} &lt;message&gt;)

Output a `info` message.

### .verbose({String} &lt;message&gt;)

Output a `verbose` message.

### .debug({String} &lt;message&gt;)

Output a `debug` message.

### .silly({String} &lt;message&gt;)

Output a `silly` message.

### .print

Output all messages stores internally.

## License

MIT © [Kiko Beats](http://www.kikobeats.com)
14 changes: 14 additions & 0 deletions example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var Acho = require('./index.js');

var acho = new Acho({
level: 'silly',
color: true
});

acho.error('error message');
acho.warning('warning message');
acho.success('success message');
acho.info('info message');
acho.verbose('verbose message');
acho.debug('debug message');
acho.silly('silly message');
6 changes: 4 additions & 2 deletions lib/Acho.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ chalk = require 'chalk'
DEFAULT =
OUTPUT_TYPE: (type) -> "#{type}\t: "
OUTPUT_MESSAGE: (message) -> message
LEVEL: 'info'
COLOR: false
TYPES:
error:
level : 0
Expand All @@ -31,8 +33,8 @@ DEFAULT =
module.exports = class Acho

constructor: (options) ->
@color = if options.color? then options.color else false
@level = if options.level? then options.level else 'info'
@color = if options.color? then options.color else DEFAULT.COLOR
@level = if options.level? then options.level else DEFAULT.LEVEL
@types = if options.types? then options.types else DEFAULT.TYPES
@messages = {}
@messages[type] = [] for type of @types
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acho",
"description": "A extremely (but powerful) logging system for NodeJS and browser.",
"description": "A extremely (but powerful) simple logging system for NodeJS and browser.",
"version": "0.1.0",
"author": {
"name": "Kiko Beats",
Expand All @@ -16,7 +16,7 @@
"devDependencies": {
"browserify": "*",
"coffee-script": "*",
"coffeeify": "^",
"coffeeify": "*",
"gulp": "*",
"gulp-header": "*",
"gulp-uglify": "*",
Expand Down
2 changes: 0 additions & 2 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ run() {
## Main
welcome && run \
test/test.coffee


0 comments on commit 5b73e9e

Please sign in to comment.