-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import fetch from 'node-fetch'; | ||
|
||
// This is a temp (and limited) API key. This should be removed when we no longer need our TurboSnap | ||
// metrics. | ||
const NEW_RELIC_KEY = 'f887ede1f80741a1cd368cac8c8aa11fFFFFNRAL'; | ||
const NEW_RELIC_ENDPOINT = 'https://log-api.newrelic.com/log/v1'; | ||
|
||
/** | ||
* Writes a log line to New Relic | ||
* | ||
* @param data The object to write | ||
*/ | ||
export async function writeLog(data: object) { | ||
const body = JSON.stringify({ | ||
name: 'cli', | ||
service: 'cli', | ||
...data, | ||
}); | ||
|
||
try { | ||
await fetch(NEW_RELIC_ENDPOINT, { | ||
method: 'POST', | ||
headers: { | ||
'Api-Key': NEW_RELIC_KEY, | ||
}, | ||
body, | ||
}); | ||
} catch { | ||
// Purposefully left blank | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters