betcode-org / flumine

flūmine - Betting trading framework
MIT License
177 stars 60 forks source link

Excessive INFO logging when market removed #725

Closed foxwoody closed 11 months ago

foxwoody commented 11 months ago

/flumine/markets/markets.py

def remove_market(...) 
        ...
        logger.info(
            "Market removed",
            extra={"market_id": market_id, "event_id": event_id, "events": self.events},
        )

If live logging is set to INFO then each market removed is logged which is fine.

However, included with this data is a list of all items in the "events" dictionary and a list of all the market objects and their memory addresses - often this one message can amount to 15k+ of text - see sample below. Suggest either changing this logging to DEBUG or omitting the "events" dictionary from the output ie extra={"market_id": market_id, "event_id": event_id},

Sample logging (11k long - only market subscription was to UK greyhounds) {"asctime": "2023-12-09 12:08:47,769", "levelname": "INFO", "message": "Market removed", "market_id": "1.222313329", "event_id": "32863922", "events": {"32863893": ["<flumine.markets.market.Market object at 0x000001BF8CD58880>", "<flumine.markets.market.Market object at 0x000001BF8CD58430>", ... ALL MARKET OBJECTS FOR THAT event_id ARE THEN LISTED

liampauling commented 11 months ago

I will remove it, ironically this was added to try and isolate a memory leak.