2020-02-22 01:08:31 +08:00
|
|
|
import axios from 'axios';
|
2020-02-22 17:16:39 +08:00
|
|
|
import {version ,env} from 'vscode';
|
|
|
|
import {getCodeLanguage,getExtensionVersion} from './shared';
|
2020-02-22 01:08:31 +08:00
|
|
|
const http = axios.create({
|
|
|
|
baseURL: 'https://leancloud.cn:443/1.1/classes/',
|
|
|
|
timeout: 1000,
|
|
|
|
headers: {
|
|
|
|
"X-LC-Id": "BKaqtaJScQuqKtkAyl5jeloo-gzGzoHsz",
|
|
|
|
"X-LC-Key": "y41qiVPTwnzLIgbDcEzcwHit",
|
|
|
|
"Content-Type": "application/json"
|
|
|
|
}
|
|
|
|
});
|
2020-02-22 17:16:39 +08:00
|
|
|
/**
|
|
|
|
* 插入日志
|
|
|
|
*/
|
|
|
|
export default function ({ rule, title, method }: { rule: string, title: string, method: string }) {
|
|
|
|
const {language,machineId} = env;
|
2020-02-22 01:08:31 +08:00
|
|
|
http.post('https://leancloud.cn:443/1.1/classes/Log', {
|
2020-02-22 17:16:39 +08:00
|
|
|
vscodeVersion: version,
|
|
|
|
codeLanguage: getCodeLanguage(),
|
2020-02-22 01:08:31 +08:00
|
|
|
language,
|
2020-02-22 17:16:39 +08:00
|
|
|
machineId,
|
2020-02-22 01:08:31 +08:00
|
|
|
rule,
|
|
|
|
title,
|
2020-02-22 17:16:39 +08:00
|
|
|
extensionVersion:getExtensionVersion(),
|
2020-02-22 01:08:31 +08:00
|
|
|
method
|
|
|
|
});
|
2020-02-22 17:16:39 +08:00
|
|
|
};
|