logcontext/ts/logcontext.classes.logmap.ts

35 lines
807 B
TypeScript
Raw Normal View History

2018-03-03 13:11:27 +00:00
import * as plugins from './logcontext.plugins';
import { Namespace } from 'smartcls';
import { Stringmap } from 'lik';
export class LogMap {
clsNamespace: Namespace;
paramMap = new plugins.lik.Stringmap();
constructor(clsNamespaceArg: Namespace) {
this.clsNamespace = clsNamespaceArg;
}
addData(paramName: string, logData) {
this.paramMap.addString(paramName);
this.clsNamespace.set(paramName, logData);
}
deleteData(paramName: string) {
this.clsNamespace.set(paramName, null);
}
getData(paramName: string) {
return this.clsNamespace.get(paramName);
}
getAllData() {
let returnObject = {};
for (let stringArg of this.paramMap.getStringArray()) {
returnObject[stringArg] = this.clsNamespace.get(stringArg);
}
return returnObject;
}
}