Fyipe Application Logger
A fyipe application logger that can be used to send logs about your applications created on your fypie dashboard. It also provides a way to track errors in your application.
Installation
NPM Install
You can install to use in your project:
$ cd project
$ npm install fyipe-log-js
Basic Usage
In a Node.js Project
; // constructor // set up tracking configurationsconst options = maxTimeline: 10;const logger = 'API_URL' // https://fyipe.com/api 'APPLICATION_LOG_ID' 'APPLICATION_LOG_KEY' options // Optional Field; // Sending a string log to the serverconst item = 'This is a simple log'; logger; // returns a promise // Sending a JSON object log to the serverconst item = user: 'Test User' page: title: 'Landing Page' loadTime: '6s' ; logger; // returns a promise // Alternatively, Logs can be tagged with either a string or an array of stringsconst item = 'This is a simple log';const tags = 'server' 'script' 'dev';logger; const tag = 'testing';logger;
In the Browser
<script src="https://unpkg.com/fyipe-log-js"></script><script> { // constructor const logger = 'API_URL' // https://fyipe.com/api 'APPLICATION_LOG_ID' 'APPLICATION_LOG_KEY' ; // Sending a string log to the server const item = 'This is a simple log'; logger; // returns a promise // Alternatively, Logs can be tagged with either a string or an array of strings const item = 'This is a simple log'; const tags = 'server' 'monitor'; logger; }</script>
Error Tracking APIs
; // constructor // set up tracking configurationsconst options = maxTimeline: 10;const tracker = 'API_URL' // https://fyipe.com/api 'ERROR_TRACKER_ID' 'ERROR_TRACKER_KEY' options // Optional Field; // capturing a timeline manuallytracker; // setting custom tagstracker; // a single tagtracker; // an array of tags // capturing error exception authomatically; // this is authomatically captured and sent to your fyipe dashboard // capturing error exception manuallytry // your code logic ; catch error tracker; // capturing error messagetracker;
API Documentation
Main API to send logs to the server.
Author: HackerBay, Inc.
- Fyipe Application Logger
new FyipeLogger(apiUrl, applicationId, applicationKey)
Create a constructor from the class, which will be used to send logs to the server.
Kind: Constructor
Returns: null
Param | Type | Description |
---|---|---|
apiUrl | string |
The Server URL. |
applicationId | string |
The Application Log ID. |
applicationKey | string |
The Application Log Key. |
new FyipeTracker(apiUrl, errorTrackerId, errorTrackerKey, options)
Create a constructor from the class, which will be used to track events and exceptions to be sent to the server.
Kind: Constructor
Returns: null
Param | Type | Description |
---|---|---|
apiUrl | string |
The Server URL. |
errorTrackerId | string |
The Error Tracker ID. |
errorTrackerKey | string |
The Error Tracker Key. |
options | object |
Set of configuration to be used for error tracking. |
logger.log(log, tags)
Logs a request of type info
to the server.
Kind: method of new FyipeLogger
Returns: Promise
- A promise response of a success or failure.
Param | Type | Description |
---|---|---|
log | string | Object |
The content to the logged on the server. |
tags | string | Array |
The tag(s) to be attached to the logged item on the server. |
logger.warning(log, tags)
Logs a request of type warning
to the server.
Kind: method of new FyipeLogger
Returns: Promise
- A promise response of a success or failure.
Param | Type | Description |
---|---|---|
log | string | Object |
The content to the logged on the server. |
tags | string | Array |
The tag(s) to be attached to the logged item on the server. |
logger.error(log, tags)
Logs a request of type error
to the server.
Kind: method of new FyipeLogger
Returns: Promise
- A promise response of a success or failure.
Param | Type | Description |
---|---|---|
log | string | Object |
The content to the logged on the server. |
tags | string | Array |
The tag(s) to be attached to the logged item on the server. |
tracker.setTag(key, value)
Set a tag for the error to be captured.
Kind: method of new FyipeTracker
Returns: null
Param | Type | Description |
---|---|---|
key | string |
The key for the tag. |
value | string |
The value for thr tag. |
tracker.setTags([{key, value}])
Set an array of tags for the error to be captured.
Kind: method of new FyipeTracker
Returns: null
Param | Type | Description |
---|---|---|
key | string |
The key for the tag. |
value | string |
The value for the tag. |
tracker.setFingerprint(fingerprint)
Set fingerprint for the next error to be captured.
Kind: method of new FyipeTracker
Returns: null
Param | Type | Description |
---|---|---|
fingerprint | string | array of strings |
The set of string used to group error messages on the server. |
tracker.addTimeline(category, content, type)
Add a custom timeline element to the next error to be sent to the server
Kind: method of new FyipeTracker
Returns: null
Param | Type | Description |
---|---|---|
category | string |
The category of the timeline event. |
content | string | Object |
The content of the timeline event. |
type | string |
The type of timeline event. |
tracker.captureMessage(message)
Capture a custom error message to be sent to the server
Kind: method of new FyipeTracker
Returns: null
Param | Type | Description |
---|---|---|
message | string |
The message to be sent to the server. |
tracker.captureExceptio(error)
Capture a custom error object to be sent to the server
Kind: method of new FyipeTracker
Returns: null
Param | Type | Description |
---|---|---|
error | object |
The Error Object to be sent to the server. |
Contribution
- Clone repository
- run
npm i
to install dependencies - run
npm run test
to run tests - run
npm run build
to build for production.