Add flag to avoid logging json to console
							parent
							
								
									f60d9dd79c
								
							
						
					
					
						commit
						bed47d3ae6
					
				| 
						 | 
					@ -39,7 +39,9 @@ class NoData(BrokerError):
 | 
				
			||||||
def resproc(
 | 
					def resproc(
 | 
				
			||||||
    resp: asks.response_objects.Response,
 | 
					    resp: asks.response_objects.Response,
 | 
				
			||||||
    log: logging.Logger,
 | 
					    log: logging.Logger,
 | 
				
			||||||
    return_json: bool = True
 | 
					    return_json: bool = True,
 | 
				
			||||||
 | 
					    log_resp: bool = False,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
) -> asks.response_objects.Response:
 | 
					) -> asks.response_objects.Response:
 | 
				
			||||||
    """Process response and return its json content.
 | 
					    """Process response and return its json content.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,7 +54,8 @@ def resproc(
 | 
				
			||||||
    except json.decoder.JSONDecodeError:
 | 
					    except json.decoder.JSONDecodeError:
 | 
				
			||||||
        log.exception(f"Failed to process {resp}:\n{resp.text}")
 | 
					        log.exception(f"Failed to process {resp}:\n{resp.text}")
 | 
				
			||||||
        raise BrokerError(resp.text)
 | 
					        raise BrokerError(resp.text)
 | 
				
			||||||
    else:
 | 
					
 | 
				
			||||||
 | 
					    if log_resp:
 | 
				
			||||||
        log.debug(f"Received json contents:\n{colorize_json(json)}")
 | 
					        log.debug(f"Received json contents:\n{colorize_json(json)}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return json if return_json else resp
 | 
					    return json if return_json else resp
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue