зеркало из https://github.com/microsoft/gather.git
Log: fix log event POST format
This commit is contained in:
Родитель
ac5048ac60
Коммит
b076913b10
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@andrewhead/gather",
|
"name": "gather",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"description": "Tools for cleaning and recovering code in Jupyter Lab",
|
"description": "Tools for cleaning and recovering code in Jupyter Lab",
|
||||||
"author": "",
|
"author": "",
|
||||||
"main": "lib/lab/index.js",
|
"main": "lib/lab/index.js",
|
||||||
|
|
|
@ -95,13 +95,16 @@ export function log(eventName: string, data?: any) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is any sensitive data to be logged, it should first be cleaned through a
|
||||||
|
// `toJSON` method defined on a class, or manually before passing it into this method.
|
||||||
|
// Earlier, we used the replacer argument to JSON.stringify, but it takes too much time
|
||||||
|
// to apply replacers to every value in the resulting JSON.
|
||||||
|
postData.data = JSON.stringify(postData.data);
|
||||||
|
|
||||||
// Submit data to logger endpoint.
|
// Submit data to logger endpoint.
|
||||||
_ajaxCaller.ajax(LOG_ENDPOINT + "/save", {
|
_ajaxCaller.ajax(LOG_ENDPOINT + "/save", {
|
||||||
// If there is any sensitive data to be logged, it should first be cleaned through a
|
|
||||||
// `toJSON` method defined on a class, or manually before passing it into this method.
|
data: JSON.parse(JSON.stringify(postData)),
|
||||||
// Earlier, we used the replacer argument to JSON.stringify, but it takes too much time
|
|
||||||
// to apply replacers to every value in the resulting JSON.
|
|
||||||
data: JSON.stringify(postData),
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
error: (_: any, textStatus: string, errorThrown: string) => {
|
error: (_: any, textStatus: string, errorThrown: string) => {
|
||||||
console.error("Failed to log", textStatus, errorThrown);
|
console.error("Failed to log", textStatus, errorThrown);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче