te-one-xlog
Version:
the te-one's xlog
95 lines (94 loc) • 2.47 kB
text/typescript
import * as uuidv4 from 'uuid/v4';
import {safeGet} from './utils';
import {config} from 'te-one-config'
let xlogOpt:CONFIG = {
location: safeGet(config.xlog, 'location', '/home/work/mobile/hotelwxxcx_xlog/xlog.log'),
appid: safeGet(config.xlog, 'appid', 'wxqbh5'),
maxsize: safeGet(config.xlog, 'maxsize', '20480'),
minsize: safeGet(config.xlog, 'minsize', '20480'),
switch: safeGet(config.xlog, 'switch', 'on')
}
export default class LOGPARAMS {
log: XLOG = new XLOG
constructor() {
this.log.app_id = xlogOpt.appid;
this.log.date_logTime = new Date();
this.log.int_xapi_count = 0;
this.log.ip_clientIp = null;
this.log.key_ck_AUTH_UNIONID = "";
this.log.key_ck_H5Channel = "";
this.log.key_ck_H5CookieId = "";
this.log.key_ck_H5SessionId = "";
this.log.key_ck_SessionToken = "";
this.log.key_ck_cityid = "";
this.log.key_ck_openid = "";
this.log.key_id = uuidv4();
this.log.key_subtype = "node";
this.log.params = "";
this.log.orderId = "";
this.log.pt = "";
this.log.pvid = uuidv4();
this.log.serverIp = null;
this.log.text_cookie = "";
this.log.text_req = "";
this.log.text_response = "";
this.log.type = "xapi";
this.log.url = "";
this.log.userAgent = "";
this.log.SDKVersion = "";
this.log.sdkVer = "";
this.log.wxVer = "";
this.log.version = "";
this.log.system = "";
this.log.xcxPubAPPVersion = "";
this.log.errorCode = "";
this.log.errorMessage = "";
}
set(obj: object) {
this.log = Object.assign(this.log, obj);
}
get(key: string) {
return this.log[key];
}
}
export class XLOG {
app_id: string;
date_logTime: any;
int_xapi_count: number;
ip_clientIp: any;
key_ck_AUTH_UNIONID: string;
key_ck_H5Channel: string;
key_ck_H5CookieId: string;
key_ck_H5SessionId: string;
key_ck_SessionToken: string;
key_ck_cityid: string;
key_ck_openid: string;
key_id: string;
key_subtype: string;
params: string;
orderId: string;
pt: string;
pvid: string;
serverIp: any;
text_cookie: string;
text_req: string;
text_response: string;
type: string;
url: string;
userAgent: string;
SDKVersion: string;
sdkVer: string;
wxVer: string;
version: string;
system: string;
xcxPubAPPVersion: string;
errorCode: string;
errorMessage: string;
}
export interface CONFIG {
location: string,
appid: string,
maxsize: string,
minsize: string,
switch: string
};