logcontext/ts/logcontext.classes.logmap.ts

32 lines
760 B
TypeScript
Raw Normal View History

2023-01-12 10:58:34 +00:00
import * as plugins from './logcontext.plugins.js';
2018-03-03 13:11:27 +00:00
export class LogMap {
2020-07-20 11:57:20 +00:00
smartcls: plugins.smartcls.SmartCls;
2018-03-03 13:11:27 +00:00
paramMap = new plugins.lik.Stringmap();
2020-07-20 11:57:20 +00:00
constructor(clsNamespaceArg: plugins.smartcls.SmartCls) {
this.smartcls = clsNamespaceArg;
2018-03-03 13:11:27 +00:00
}
2021-09-17 17:21:34 +00:00
addData(paramName: string, logData: any) {
2018-03-03 13:11:27 +00:00
this.paramMap.addString(paramName);
2020-07-20 11:57:20 +00:00
this.smartcls.set(paramName, logData);
2018-03-03 13:11:27 +00:00
}
deleteData(paramName: string) {
2020-07-20 11:57:20 +00:00
this.smartcls.set(paramName, null);
2018-03-03 13:11:27 +00:00
}
getData(paramName: string) {
2020-07-20 11:57:20 +00:00
return this.smartcls.get(paramName);
2018-03-03 13:11:27 +00:00
}
getAllData() {
2021-09-17 17:21:34 +00:00
const returnObject: any = {};
2020-07-20 11:57:20 +00:00
for (const stringArg of this.paramMap.getStringArray()) {
returnObject[stringArg] = this.smartcls.get(stringArg);
2018-03-03 13:11:27 +00:00
}
return returnObject;
}
}