prediction-market-agent-tooling 0.64.3.dev612__py3-none-any.whl → 0.64.5.dev616__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,8 @@ class LogConfig(BaseSettings):
33
33
 
34
34
 
35
35
  class _CustomJsonFormatter(jsonlogger.JsonFormatter):
36
+ MAX_MESSAGE_LENGTH = 50_000
37
+
36
38
  def add_fields(
37
39
  self,
38
40
  log_record: dict[str, t.Any],
@@ -45,6 +47,12 @@ class _CustomJsonFormatter(jsonlogger.JsonFormatter):
45
47
  log_record["level"] = log_record["levelname"]
46
48
  log_record["severity"] = log_record["levelname"]
47
49
 
50
+ message = str(log_record.get("message", ""))
51
+ if message and len(message) > self.MAX_MESSAGE_LENGTH:
52
+ log_record["message"] = (
53
+ message[: self.MAX_MESSAGE_LENGTH] + " . . . TRUNCATED . . ."
54
+ )
55
+
48
56
  @staticmethod
49
57
  def get_handler() -> logging.StreamHandler: # type: ignore # Seems correct, but mypy doesn't like it.
50
58
  logHandler = logging.StreamHandler()
@@ -63,12 +71,12 @@ def _handle_exception(
63
71
  logger.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))
64
72
 
65
73
 
66
- def patch_logger() -> None:
74
+ def patch_logger(force_patch: bool = False) -> None:
67
75
  """
68
76
  Function to patch loggers according to the deployed environment.
69
77
  Patches Loguru's logger, Python's default logger, warnings library and also monkey-patch print function as many libraries just use it.
70
78
  """
71
- if not getattr(logger, "_patched", False):
79
+ if force_patch or not getattr(logger, "_patched", False):
72
80
  logger._patched = True # type: ignore[attr-defined] # Hacky way to store a flag on the logger object, to not patch it multiple times.
73
81
  else:
74
82
  return
@@ -78,6 +86,8 @@ def patch_logger() -> None:
78
86
  if config.LOG_FORMAT == LogFormat.GCP:
79
87
  handler = _CustomJsonFormatter.get_handler()
80
88
  print_logging = print_using_logger_info
89
+
90
+ # Patch raised exceptions.
81
91
  sys.excepthook = _handle_exception
82
92
  typer.main.except_hook = _handle_exception # type: ignore # Monkey patching, it's messy but it works.
83
93
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.64.3.dev612
3
+ Version: 0.64.5.dev616
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -35,7 +35,7 @@ prediction_market_agent_tooling/gtypes.py,sha256=bUIZfZIGvIi3aiZNu5rVE9kRevw8sfM
35
35
  prediction_market_agent_tooling/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  prediction_market_agent_tooling/jobs/jobs_models.py,sha256=8vYafsK1cqMWQtjBoq9rruroF84xAVD00vBTMWH6QMg,2166
37
37
  prediction_market_agent_tooling/jobs/omen/omen_jobs.py,sha256=Pf6QxPXGyie-2l_wZUjaGPTjZTlpv50_JhP40mULBaU,5048
38
- prediction_market_agent_tooling/loggers.py,sha256=R56BCTlJ7GZMNHgAtF1QLe0hrRzchcO2NdbKr-v0Q7g,4217
38
+ prediction_market_agent_tooling/loggers.py,sha256=gQoBcHcuWA5PECEi_ZoNbuy8F6JE92H6fjJ84cum-AQ,4573
39
39
  prediction_market_agent_tooling/markets/agent_market.py,sha256=1NomilM0GCXcRq_1N_cr2AbSK5ONTowFeRbrhc7V5zE,14929
40
40
  prediction_market_agent_tooling/markets/base_subgraph_handler.py,sha256=7RaYO_4qAmQ6ZGM8oPK2-CkiJfKmV9MxM-rJlduaecU,1971
41
41
  prediction_market_agent_tooling/markets/blockchain_utils.py,sha256=qm21scopQ6dfewkoqQF6lWLDGg2BblsKUdC9aG93Hmc,2249
@@ -124,8 +124,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=yuW8iPPtcpP4eLH2nORMD
124
124
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
125
125
  prediction_market_agent_tooling/tools/utils.py,sha256=AC2a68jwASMWuQi-w8twl8b_M52YwrEJ81abmuEaqMY,6661
126
126
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=zRq-eeBGWt8uUGN9G_WfjmJ0eVvO8aWE9S0Pz_Y6AOA,12342
127
- prediction_market_agent_tooling-0.64.3.dev612.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
128
- prediction_market_agent_tooling-0.64.3.dev612.dist-info/METADATA,sha256=Wk7zNBfabN4TcWK_BjxZIajr_0T1FOyl5AnW8V5Wu9U,8748
129
- prediction_market_agent_tooling-0.64.3.dev612.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
130
- prediction_market_agent_tooling-0.64.3.dev612.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
131
- prediction_market_agent_tooling-0.64.3.dev612.dist-info/RECORD,,
127
+ prediction_market_agent_tooling-0.64.5.dev616.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
128
+ prediction_market_agent_tooling-0.64.5.dev616.dist-info/METADATA,sha256=C_0n8zp6Xp6M8ECIZmJeIZBurMLo14NNJYZpgjYJjcQ,8748
129
+ prediction_market_agent_tooling-0.64.5.dev616.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
130
+ prediction_market_agent_tooling-0.64.5.dev616.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
131
+ prediction_market_agent_tooling-0.64.5.dev616.dist-info/RECORD,,