Giter Club home page Giter Club logo

driftwood.js's Introduction

driftwood.js

Driftwood a dirt simple logging framework for javascript

Goals

  • Logging should be simple, this isn't java we don't need abstract interfaces just a few simple options.
  • 4 Log levels, thats it. (debug, info, error, and exception)
  • Allow exceptions or logs to be sent to a backend server. If an error falls in the forest and no one hears it did it really happen?

Install

We're registered on bower:

bower install --save driftwood.js

Or, if bower ain't your thing, simply include driftwood.js or driftwood.min.js in your project.

Getting Started

Getting started with driftwood is dead simple. You don't have to created an instance, you can just use the static logger methods:

Driftwood.info("my info message");
Driftwood.debug("my debug message");
Driftwood.error("my error message");

In addition to the above 3 methods, we also have a 4th special method, exception. This method logs to your backend if configured.

Driftwood.exception("an exceptional message");

To configure your backend url. Note -- this is cross origin safe since we use GET requests.

Driftwood.setServerPath("/errors/test?payload=")

Driftwood's default environment is 'development'. Environments control which messages are actually displayed in the console.

With the 'development' environment, we show all log messages in the console. The alternate is 'production'; and it will only display errors on the console. You can change the environment with the env method.

Driftwood.env("production");

If having a single static logger doesn't work for you, you can also create multiple logger instances:

var my_logger = new Driftwood.logger();
my_logger.env("production");
my_logger.debug("instance logger : Should not see this");
my_logger.error("instance logger : should see this");

In addition to setting the environment, you can also manually change the current log level:

my_logger.logLevel("INFO")
Driftwood.logLevel("ERROR")

By default any uncaught exceptions in your application's window will goto Driftwood, to manually send one

Driftwood.exception("Message here")
Driftwood.exception(exception_obj)

To check out a nicely formatted help page of the source code

Commented source code

To contribute to this project please fork, and add tests to whatever you change so its easier to maintain. See the test folder for jasmine tests and open specrunner.html.

driftwood.js's People

Contributors

mattkanwisher avatar pthrasher avatar

Stargazers

Chris Pittman avatar  avatar Brian Stanback avatar Ilya Ayzenshtok avatar Charles Grunwald avatar Peter Craig avatar Vijay Rudraraju avatar Wbdsjunior avatar Adam Kuśmierz avatar Enoi Barrera Guzman avatar hacfi avatar Peter avatar  avatar Tanmay Patel avatar Maciej Smolinski avatar Todd Terwilliger avatar  avatar Kevin Vanderbeken avatar JP Given avatar Dave Cadwallader avatar Ezequiel Calderara avatar Marsh Gardiner avatar Eugene Gimelberg avatar David Michael avatar

Watchers

Paul Dix avatar hacfi avatar Chris Love avatar James Cloos avatar  avatar

driftwood.js's Issues

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.