mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add filter
This commit is contained in:
@@ -15,7 +15,7 @@ Device.getInfo().then(e => {
|
||||
device = e
|
||||
});
|
||||
|
||||
export function XTracerAsync({name, log, bugPrint}: any) {
|
||||
export function XTracerAsync({ name, log, bugPrint }: any, p0?: any) {
|
||||
return (
|
||||
target: unknown,
|
||||
propertyKey: string,
|
||||
@@ -26,12 +26,14 @@ export function XTracerAsync({name, log, bugPrint}: any) {
|
||||
|
||||
const requestId = uuidv4()
|
||||
const span = tracerInstance.startSpan(name);
|
||||
|
||||
let hasBug:Boolean
|
||||
|
||||
const createTracingInstance = (): TracingType => {
|
||||
const logs: any[] = []
|
||||
const data = {
|
||||
event: {},
|
||||
tags: {}
|
||||
}
|
||||
|
||||
const createTracingInstance = (): TracingType => {
|
||||
|
||||
return {
|
||||
span: span as any,
|
||||
@@ -42,27 +44,23 @@ export function XTracerAsync({name, log, bugPrint}: any) {
|
||||
span.setStatus(status);
|
||||
},
|
||||
addEvent: (context: string, message?: any, obj?: any) => {
|
||||
if(log == true) {
|
||||
// logger.error(obj, context, message)
|
||||
} else {
|
||||
logs.push({context, message: message, obj})
|
||||
}
|
||||
|
||||
data.event[context] = message;
|
||||
|
||||
const value = [JSON.stringify(message)] as any
|
||||
span.addEvent(context, value);
|
||||
},
|
||||
LocalLogEvent:(context: string, message: any, obj: any) => {
|
||||
logs.push({context, message, obj})
|
||||
data.tags[context] = message;
|
||||
},
|
||||
setAttribute: (key: string, value: string) => {
|
||||
data.tags[key] = value;
|
||||
span.setAttribute(key, value);
|
||||
},
|
||||
finish: () => {
|
||||
span.end();
|
||||
if(bugPrint && hasBug) {
|
||||
for(const {context, message, obj} of logs) {
|
||||
// logger.error(obj, context, message)
|
||||
}
|
||||
console.error(name, data)
|
||||
}
|
||||
},
|
||||
bugFlag:() => {
|
||||
@@ -76,7 +74,7 @@ export function XTracerAsync({name, log, bugPrint}: any) {
|
||||
|
||||
const tracing = createTracingInstance()
|
||||
tracing.setAttribute('current.page', window.location.pathname);
|
||||
tracing.setAttribute('device.name', device.name || device.model)
|
||||
tracing.setAttribute('device.name', device?.name || device?.model)
|
||||
|
||||
args.push(tracing)
|
||||
|
||||
@@ -111,9 +109,12 @@ export function XTracer({name, log, bugPrint}: any) {
|
||||
|
||||
let hasBug:Boolean
|
||||
|
||||
const createTracingInstance = (): TracingType => {
|
||||
const logs: any[] = []
|
||||
const data = {
|
||||
event: {},
|
||||
tags: {}
|
||||
}
|
||||
|
||||
const createTracingInstance = (): TracingType => {
|
||||
|
||||
return {
|
||||
span: span as any,
|
||||
@@ -124,27 +125,23 @@ export function XTracer({name, log, bugPrint}: any) {
|
||||
span.setStatus(status);
|
||||
},
|
||||
addEvent: (context: string, message?: any, obj?: any) => {
|
||||
if(log == true) {
|
||||
// logger.error(obj, context, message)
|
||||
} else {
|
||||
logs.push({context, message: message, obj})
|
||||
}
|
||||
|
||||
data.event[context] = message;
|
||||
|
||||
const value = [JSON.stringify(message)] as any
|
||||
span.addEvent(context, value);
|
||||
},
|
||||
LocalLogEvent:(context: string, message: any, obj: any) => {
|
||||
logs.push({context, message, obj})
|
||||
data.tags[context] = message;
|
||||
},
|
||||
setAttribute: (key: string, value: any) => {
|
||||
setAttribute: (key: string, value: string) => {
|
||||
data.tags[key] = value;
|
||||
span.setAttribute(key, value);
|
||||
},
|
||||
finish: () => {
|
||||
span.end();
|
||||
if(bugPrint && hasBug) {
|
||||
for(const {context, message, obj} of logs) {
|
||||
// logger.error(obj, context, message)
|
||||
}
|
||||
console.error(name, data)
|
||||
}
|
||||
},
|
||||
bugFlag:() => {
|
||||
@@ -158,7 +155,7 @@ export function XTracer({name, log, bugPrint}: any) {
|
||||
|
||||
const tracing = createTracingInstance()
|
||||
tracing.setAttribute('current.page', window.location.pathname);
|
||||
tracing.setAttribute('device.name', device.name || device.model)
|
||||
tracing.setAttribute('device.name', device?.name || device?.model)
|
||||
|
||||
args.push(tracing)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user