.. | ||
oneuptime_sdk | ||
.gitignore | ||
LICENSE | ||
pyproject.toml | ||
README.md | ||
README.rst | ||
requirements.txt | ||
setup.cfg | ||
setup.py |
OneUptime SDK
A oneuptime sdk for application logger that can be used to send logs about your applications created on your fypie dashboard which can also used for error tracking
Usage
Usage can be found at Examples and Usage
API Documentation
Main API to send logs to the server.
Author: HackerBay, Inc.
OneUptimeLogger(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. |
logger.log(log, tags)
Logs a request of type info
to the server.
Kind: method of OneUptimeLogger
Returns: Object
- An object 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(warning, tags)
Logs a request of type warning
to the server.
Kind: method of OneUptimeLogger
Returns: Object
- An object response of a success or failure.
Param | Type | Description |
---|---|---|
warning | 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(error, tags)
Logs a request of type error
to the server.
Kind: method of OneUptimeLogger
Returns: Object
- An object response of a success or failure.
Param | Type | Description |
---|---|---|
error | 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. |
OneUptimeTracker(apiUrl, errorTrackerId, errorTrackerKey)
Create a constructor from the class, which will be used to track errors 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. |
option | object |
The options to be considred by the tracker. |
options
Param | Type | Description |
---|---|---|
maxTimeline | int |
The total amount of timeline that should be captured, defaults to 5 |
captureCodeSnippet | boolean |
When set as True stack traces are automatically attached to all error sent to your oneuptime dashboard. |
tracker.setTag(key, value)
Set tag for the error to be sent to the server.
Kind: method of OneUptimeTracker
Returns: null
Param | Type | Description |
---|---|---|
key | string |
The key for the tag. |
value | string |
The value for the tag. |
tracker.setTags([{key, value}])
Set multiple tags for the error to be sent to the server. Takes in a list
Kind: method of OneUptimeTracker
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 OneUptimeTracker
Returns: null
Param | Type | Description |
---|---|---|
fingerprint | string | list of strings |
The set of string used to group error messages on the server. |
tracker.addToTimeline(category, content, type)
Add a custom timeline element to the next error to be sent to the server
Kind: method of OneUptimeTracker
Returns: null
Param | Type | Description |
---|---|---|
category | string |
The category of the timeline event. |
content | string | dict |
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 OneUptimeTracker
Returns: Promise
Param | Type | Description |
---|---|---|
message | string |
The message to be sent to the server. |
tracker.captureException(error)
Capture a custom error object to be sent to the server
Kind: method of OneUptimeTracker
Returns: Promise
Param | Type | Description |
---|---|---|
error | Exception object |
The Error Object to be sent to the server. |
Contribution
- Clone repository
- run
pip install -r requirements.txt
to install dependencies - run
python -m unittest discover -s oneuptime_sdk/tests
to run tests