1.0.5 • Published 3 years ago

kalayo-logger v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Kalayo JS Logger

This function connects to the easy-to-use Kalayo service for use with any JavaScript service. Try it out for free today!

NPM

Documentation

Installation

npm install kalayo

or

yarn add kalayo

Usage

Initialization

You'll need to initialize the url where you want the logs to be sent. This should be executed before making any logs. An ideal place to put this would be at the the top level of your application. You only need to do this once.

The Kalayo() function accepts a headers object as an optional second parameter. If you're using Kalayo's dashboard, make sure to pass an Authorization property with your API token as its value.

import Kalayo from 'kalayo';

new Kalayo('https://localhost:3000', {
  'Authorization': `Bearer ${token}`
});

Logging

The actual log functions can be found below.

import { log, d, w, e } from 'kalayo';

log()

log(message, stackTrace, logOptions)
ParameterDescriptionRequiredTypeDefault
messageText to display for the log.nostringnull
stackTraceStack trace detailsnoobject or string""
logOptionsOther info you want to pass to the server.noobjectdefault

d()

Same signature as log but overrides logOptions.level to 'default'.

d(message, stackTrace, logOptions)

w()

Same signature as log but overrides logOptions.level to 'warning'.

w(message, stackTrace, logOptions)

e()

Same signature as log but overrides logOptions.level to 'error'.

e(message, stackTrace, logOptions)

Suggested log options

PropertyTypeValuesDefault
logLevelstring'default','warning','error'undefined
osstring'Web', 'Android', 'iOS'undefined
osVersionstring'12.0', '9.1.1'undefined
deviceTypestring'iPhone', 'Google Pixel'undefined
deviceVersionstring'X', '3'undefined

License

MIT © AMAGI

1.0.5

3 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago