| File | Date | Author | Commit |
|---|---|---|---|
| .gitignore | 2022-04-18 |
|
[1a4951] Initial Release |
| README.md | 2022-04-18 |
|
[079b75] Added sponsored link |
| index.js | 2022-04-18 |
|
[1a4951] Initial Release |
| package-lock.json | 2022-04-18 |
|
[1a4951] Initial Release |
| package.json | 2022-04-18 |
|
[079b75] Added sponsored link |
The only log manager you'll ever need! Sponsored by Blog Desire
kLogs is a super simple logger for any of your projects. Some example use cases are tracking errors on your project. Sample SDK is available for some common languages. Yet, it's extremely simple to use with any programming language!
The primary concept is pretty simple. You get the API key, you prepare your log, and send a post request with the log to the server. And the next time you visit the server, you can see all the logs you have prepared and sent to the server!
First you load the kLogs SDK.
<script src="https://logs.khokon.dev/kLogs.js">
Or install via npm
npm install @khokonm/klogs
Make sure to require kLogs before using when installed via npm
const kLogs = require("@khokonm/klogs")
Then you create a new instance of the kLogs SDK.
var Logs = new kLogs('YOUR_API_KEY');
After that you prepare your log.
var log = {
"message": "This is a log message",
"source": "Project X",
"medium": "ServerSide Script",
"additional_info": {
"server": "node-16",
"note": "a sample note"
}
};
Logs.prepare(log);
Finally you send the log to the server.
Logs.send();
The send method returns a promise. You can use the then method to get the response.
Logs.send().then((response) => {
console.log(response);
});
and you can use the catch method to handle errors.
Logs.send().catch((error) => {
console.log(error);
});
or you might want to use the async/await syntax.
const response = await Logs.send();
console.log(response);
Alltogether it should look something like this:
var Logs = new kLogs('YOUR_API_KEY');
var log = {
"message": "This is a log message",
"source": "Project X",
"medium": "ServerSide Script",
"additional_info": {
"server": "node-16",
"note": "a sample note"
}
};
Logs.prepare(log);
const response = await Logs.send();
console.log(response);
kLogs still brand new and hasn't developed a lot more SDKs yet. But you can contact here to request for SDK in a new language. We will be happy to add it.
But if you want to use kLogs in your language, you can use just follow these steps:
https://logs.khokon.dev/apiThe body of the request should be a JSON object. The following parameters are available currently:
message: The message of the log. (String, Required)source: The source of the log. (String, Optional)medium: The medium of the log. (String, Optional)additional_info: Additional information of the log. (Object, Optional)kLogs is still in beta and it's 100% free. So, we had to put some limitations on the usage/number of requests. Here are some of them:
kLogs is licensed under the MIT license.
If you want to contribute to kLogs, please check out here.
kLogs version is 1.0.1.