let errors slide through, need to style them
This commit is contained in:
		
							parent
							
								
									9b48b8ea81
								
							
						
					
					
						commit
						b354eec7a0
					
				
					 1 changed files with 9 additions and 6 deletions
				
			
		
							
								
								
									
										13
									
								
								mongoprof.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								mongoprof.py
									
									
									
									
									
								
							|  | @ -38,17 +38,18 @@ def watch(dbname, refresh): | ||||||
|                 output.append(colored('{ns}'.format(**e), 'blue')) |                 output.append(colored('{ns}'.format(**e), 'blue')) | ||||||
| 
 | 
 | ||||||
|             # operation |             # operation | ||||||
|             if e['op'] == 'query': |             op = e.get('op') | ||||||
|  |             if op == 'query': | ||||||
|                 output.append(colored('query {query}'.format(**e), 'cyan')) |                 output.append(colored('query {query}'.format(**e), 'cyan')) | ||||||
|             elif e['op'] == 'update': |             elif op == 'update': | ||||||
|                 output.append(colored('update {query}'.format(**e), 'green')) |                 output.append(colored('update {query}'.format(**e), 'green')) | ||||||
|             elif e['op'] == 'getmore': |             elif op == 'getmore': | ||||||
|                 output.append(colored('getmore {0}'.format(e.get('query', '')), |                 output.append(colored('getmore {0}'.format(e.get('query', '')), | ||||||
|                                       'grey')) |                                       'grey')) | ||||||
|             elif e['op'] == 'command': |             elif op == 'command': | ||||||
|                 output.append(colored('{command}'.format(**e), 'cyan')) |                 output.append(colored('{command}'.format(**e), 'cyan')) | ||||||
|             else: |             else: | ||||||
|                 output.append(colored('unknown operation: {op}'.format(**e), |                 output.append(colored('unknown operation: {0}'.format(op), | ||||||
|                                       'red')) |                                       'red')) | ||||||
|                 print(e) |                 print(e) | ||||||
| 
 | 
 | ||||||
|  | @ -62,6 +63,8 @@ def watch(dbname, refresh): | ||||||
|                                       'green')) |                                       'green')) | ||||||
|             if e.get('scanAndOrder'): |             if e.get('scanAndOrder'): | ||||||
|                 output.append(colored('scanAndOrder', 'red')) |                 output.append(colored('scanAndOrder', 'red')) | ||||||
|  | 
 | ||||||
|  |             if 'millis' in e: | ||||||
|                 output.append(colored('{millis}ms'.format(**e), 'green')) |                 output.append(colored('{millis}ms'.format(**e), 'green')) | ||||||
|             print(' '.join(output)) |             print(' '.join(output)) | ||||||
|             last_ts = e['ts'] |             last_ts = e['ts'] | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 James Turk
						James Turk