/loggn

Logging, done a bit simpler.

Primary LanguageJavaScriptMIT LicenseMIT

loggn

travis npm version npm downloads Standard - JavaScript Style Guide

Logging, done a bit simpler.

Why?

Why write console.log('hello world') when you can write log('hello world')

Table of Contents

Install

Add loggn to your project using npm or yarn.

Install (NPM):

$ npm install loggn --save

Install (Yarn):

$ yarn add loggn

Usage

loggn

The default export from loggn is a function that takes 2 arguments. The first argument is what you want to log. The second argument is the log type (log, warn, error etc)

import loggn from 'loggn'
loggn('Hello World') // Hello World
loggn('Hello World', 'error') // Hello World
You can also import the log types individually as follows.

log, error, info, warn

import { log, error, info, warn } from 'loggn'
log(123) // 123
log('Hello World') // Hello World
error('This went wrong') // This went wrong

assert

import { assert } from 'loggn'
assert(1) // undefined
assert(typeof '123' === 'object') // Assertion failed: console.assert

clear

import { clear } from 'loggn'
clear() // Console was cleared

count

import { count } from 'loggn'
count() // 0
count() // 1
count() // 2

group

import {group, groupCollapsed, groupEnd} from 'loggn'

profile

import {profile, profileEnd} from 'loggn'

table

import {table} from 'loggn'

time

import {time, timeEnd} from 'loggn'

trace

import {trace} from 'loggn'

Contributing

Pull requests for new features, bug fixes, and suggestions are welcome!

License

MIT