Warrings include whole image in binary.
I am using logger with three handlers:
- console
- graypy
- reportportal
Reportportal handler is able to log images. So I would like to log them and I am expecting that console log and graypy log in this situation remain silent or print some warring.
Graypy, however, post waring which contains the whole big image in binary and make impossible to read other console logs.
/env/lib64/python3.7/site-packages/graypy/handler.py:469: GELFChunkOverflowWarning: chunk overflowing GELF message: b'x\x9c\xec\xbd\xfb[\xd3N\xd07\xfc\xafp\xa8\n\x88\x90C\x93\xb4\x88\nrFD\x0e\x82\x80\x15mJ#\x08\x14\x84""\xea\xdf\xfet\xb3\x9fIf\xb2\x9b\xe2\xf7~\xdf\x1f\x9e\xeb\xb9n/\xaf-m\x92\xcd\xee\xec\x9cgv\xf6~\xe8G\xfb\xea\xfa\xe4\xa2345\xe4N8C\xe3C\xc7\x17\xd7\xdd\xde\x97\xb3\x8b\xcb\x9b\xd6q\xef\xfb\xf5\xf1\xc5U\xf7\xf3y\xfb\xfa\xba\xf9\xb5\xdd\xbb\xf0\xe3\xe4\xa8}1p\xdd\xbaj\xb7;\xbdk\xdd\x81\xee\xf9\xe5d\xfe\xd5\x9d\xb8\xec|\xed=\xd6=\xe9=\xd2m\x9e_\x0eM\xb9A-\xaaF5/\x0c\'|\xc7\xa9\xd6\xfd`|\xe8\xac\xfd\xa3}64\x15\x8e\x0f%\xcd\xd6\xc9\xd9I\xf7\xae\xd7\xf5\xe5Y\xf3\xae}\xf5\xac\xdb{\xf0\xba\xd7Err\xa6^8y|q\xde\x9e\xfcv\xd2=mN~=\xe9N&W\x17\x9d\xee\xb3v\xe7(\xbd\xf1\xa4\xf3u\xf2\xfc\xee\xa6{rv=\xd9\xba8\xbfl^\xb5W\xce{#\x9d\xb8\xbc\xebuqv\xd2\xe9u\xe1\xf9\xe3C\x9f\x93\x9bN\xab\xab\'zv\xf1\xf5\xf3\x89\xba\xa9w\xc7\xe7\xcb\x93\xa3\xde\x1d\xb5zM\xdd\xd4=\xbej7\x8f>w\x9a\xe7\xea\xcdo\x9b\'\x9d\xf7\xe9/\xe9\x8dW\x17\xad\x1e\x14\xf8\xc5\r\xfd\x93\xba\xda\x9bk\xeb\xf4\xf3I\'\xb9\x18\x9a\xea\xdc\x9c\x9d\xf5~jv{\xbf\x1d\x9f\xb7;=x\xde\x0f\x1d5\xbb\xcd\xdec\x8d\x9b$I\x8e6\xd6\x97\x1aW\x8dN\xe3\xc6q\xdc\xa6\xfet\x1c\xd1^\xad,\xcfo\x19\xbfW-w\xaa\xd6\xd3\xdd6\xe2\xf4[h\xdeU\xbb=M_\xe6\xf2\x1f\x07\xf4\xc7\xca\xfc\xec\xfb\x9f\xe8 m\xf7\xf5GE\x7f\xfc\xd1\x1f\x1f\xf5\xc7\x87\x0f\xe9C\x89\xfe6\xb7\xae?\xbb;\xfa3\xf4\xf5\xe7%\xef\xae\xbcu\xc2z\xa4\xffN\xf8\x05\xaf\xa5?\xaf\xad\xcf8n\x1d/\xdfL\xbfU\xcd\xeb\x9ff\xf8 u;8\xa3?\xf1\xf5\x03\xbf6\x9f\xde\xee\xf3\x9f\x9e\xaa\xd1\xb5\x1c\xfd\xe5\x0b\xeb\xbcf\xfc\xd4[\x15\xf1\xa6C\xfd1\xa5?\x86\xd3\xa7\x12Z\xbe\xec\xa1\xe4Ic\xc8\xc3\x7f\xf6\xf0\xaf\xb1\xfd\x9b\x97e\x10\x9b\xca\xd7\xd0\xad\xbfY,N<J\xec\x7f\x13\xc0\x14z\xfc\xcb\xb2\xe4\xed;
I would like to see warring which contains only informartion about binary content or short preview.
A quick solution is to ignore the GELFChunkOverflowWarning warnings by prefixing your code with:
warnings.filterwarnings("ignore", category=GELFChunkOverflowWarning)
If you know the image header's magic numbers you can also add them to the the call to warnings.filterwarnings with the message argument to further filter down your suppression of GELFChunkOverflowWarning warnings.
I would also look at https://docs.python.org/3/library/warnings.html#the-warnings-filter for reference.