Improve log
This commit is contained in:
		
							parent
							
								
									773d104306
								
							
						
					
					
						commit
						5f68d08cbc
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -46,12 +46,14 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// API invoking
 | 
						// API invoking
 | 
				
			||||||
	try {
 | 
						try {
 | 
				
			||||||
		const a = performance.now();
 | 
							const before = performance.now();
 | 
				
			||||||
		res = await exec(data, user, app);
 | 
							res = await exec(data, user, app);
 | 
				
			||||||
		const b = performance.now();
 | 
							const after = performance.now();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (b - a > 500) {
 | 
							const time = after - before;
 | 
				
			||||||
			console.warn(`SLOW API CALL DETECTED: ${ep.name}`);
 | 
					
 | 
				
			||||||
 | 
							if (time > 500) {
 | 
				
			||||||
 | 
								console.warn(`SLOW API CALL DETECTED: ${ep.name} (${ time }ms)`);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} catch (e) {
 | 
						} catch (e) {
 | 
				
			||||||
		rej(e);
 | 
							rej(e);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue