yo-logs
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

YO Logger (yo-logs)

Overview

Deceptively simple, awesome JavaScript / TypeScript logger with emojis

Installation

yarn install yo-logs

Usage

Boilerplate

import YO from 'yo-logs'
const yo = YO.init()

Basic

yo.log({ message: 'Hello world' })

Log types

import { YoLogType } from 'yo-logs'

yo.log({ message: 'Hello world', type: YoLogType.LOG })
yo.log({ message: 'Hello world', type: YoLogType.SUCCESS })
yo.log({ message: 'Hello world', type: YoLogType.ERROR })
yo.log({ message: 'Hello world', type: YoLogType.WARNING })
yo.log({ message: 'Hello world', type: YoLogType.REDIRECT })
yo.log({ message: 'Hello world', type: YoLogType.NOT_FOUND })

Logging data

yo.log({ message: 'Hello world', data: { foo, bar }})

Overriding output

yo.log({ message: 'Hello world', id: 'FOO', name: 'BAR'})

Logging Successful messages

yo.ok({ message: 'Hello world', data, id: 'ABC', name: 'bar' })

Logging Error messages

yo.err({ message: 'Hello world', data, id: 'ABC', name: 'bar' })

Logging Warning messages

yo.warn({ message: 'Hello world', data, id: 'ABC', name: 'bar' })

Logging API requests

import { YoLogType } from 'yo-logs'

yo.req({ req, type: YoLogType.SUCCESS, message })
yo.req({ req, type: YoLogType.WARNING, message })
yo.req({ req, type: YoLogType.ERROR, message })

Package Sidebar

Install

npm i yo-logs

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

31.7 kB

Total Files

19

Last publish

Collaborators

  • jesussteve