This is a lib to send Logmessages directly from your Javascript/Node.js Application to a Funkserver
You need a running Funkserver.
You need to know the Access-Key.
npm install funk-agent --save
Optimal you have a loging lib like winston or something else.
IMPORTANT:
set this Code by Applicationstart:
const {FunkAgent} = require('funk-agent')
const funk_con = new FunkAgent("[ServerURL]","[ACCESSKEY]")
And now you can log inside you logging event.
funk_con.sendSugar({
attr: {
container: "Test", // attributesinformation to specify this application
hostname: "spezial host", // attributesinformation to specify the server
},
data: [{ // A free to choose obj. use what you want.
message: "high obj",
time: new Date(Date.now()),
request_time: 0.002,
request_type: "ms",
}],
searchindex: "test-js-agent-sugar" //the elasticsearchindex where this information will be saved.
})
You can choose the function sendSugar
and send
sendSugar
is a littlebit slower but easier to use
send
is faster but more complex.
Normally sendSugar
will be fast enough.
If the application lost the connection to your server. It will automatically try to reconnect. You send messages will be add to a queue and sending later. After connection is back.
Here is a small example Projekt: funk-js-agent-example