any-rule/src/insertLog.ts

28 lines
834 B
TypeScript
Raw Normal View History

2020-02-22 01:08:31 +08:00
import axios from 'axios';
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"
}
});
/**
*
*/
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', {
vscodeVersion: version,
codeLanguage: getCodeLanguage(),
2020-02-22 01:08:31 +08:00
language,
machineId,
2020-02-22 01:08:31 +08:00
rule,
title,
extensionVersion:getExtensionVersion(),
2020-02-22 01:08:31 +08:00
method
});
};