Skip to content

Commit

Permalink
Implementing Initial Monitor Interaction Code #39
Browse files Browse the repository at this point in the history
  • Loading branch information
TanmoySG committed Jun 17, 2022
1 parent d7c2e10 commit 8f6c148
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions libraries/js/logsmith/monitor/monitor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import compile from "string-template/compile.js"
import fetch from 'node-fetch'

const Endpoints = {
API: compile("{0}/"),
Publisher: compile("{0}/publisher"),
Context: compile("{0}/{1}/context"),
Log: compile("{0}/{1}/{2}/logs")
}


export function logToMonitor(listener, publisher, context, log, callback) {
const logURI = Endpoints.API(listener)
fetch(logURI).then(function (response) {
return response.json()
}).then(function (response) {
console.log(response)
})
}

logToMonitor("http://localhost:8080")

0 comments on commit 8f6c148

Please sign in to comment.