Code Monkey home page Code Monkey logo

mono's Introduction

mono

yet another log library for browser

Setup

Just include mono.js

<script type="text/javascript" src="mono.js"></script>

or require it as AMD module.

define(['mono'], function(Mono) {
    // your code with mono
});

Usage

// You can get a simple log by call Mono.(l|i|d|w|e)();
// format: [date] - [level] - [domain] - [message]

Mono.l('foo');
// > Dec 14 2012 17:58:35,516 - LOG - root - foo

// default domain is 'root'. You can seperate log domain by
// make a Mono instance.

var m = new Mono('other.module');
m.i('bar');
// > Dec 14 2012 18:02:30,770 - INFO - other.module - bar

// You can set a log level by calling .setLevel() function
// When you call this to *Mono* factory, this changes the
// default log level. Initially default sets to Mono.LOG
// (the lowest: every log shown) if .setLevel() called with
// Mono instance, log level affects only to that instance.

Mono.setLevel(Mono.WARNING);
Mono.i('baz');
// > --*-- nothing happened --*--

var m2 = new Mono('another.module');
m2.i('qux');
// > --*-- nothing happened --*--

m2.setLevel(Mono.INFO);
m2.i('qux');
// > Dec 14 2012 18:11:04,494 - INFO - another.module - qux

// You can totally turn off (or turn on) by calling
// Mono.off() (or Mono.on()).

Mono.off();
m2.e('corge');
// > --*-- nothing happened --*--

Mono.on();
m2.e('corge');
// > Dec 14 2012 18:14:11,413 - ERROR - another.module - corge

Compatability

Works great in chrome. HAHA!

Test

mono was fully tested by hand!

License

MIT.

mono's People

Contributors

yanhkim avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.