Skip to content

Commit c576575

Browse files
committed
fix: ensure logger is accessed by reference to latest instance in config
1 parent 40d0d27 commit c576575

File tree

13 files changed

+37
-50
lines changed

13 files changed

+37
-50
lines changed

docs/html/.buildinfo

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: a0ddb94c9519cbe4048eaa2307361694
3+
config: 4f7050ca2baf67d0b4155492574876de
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/html/.buildinfo.bak

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: a0ddb94c9519cbe4048eaa2307361694
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/html/_sources/autoapi/algokit_utils/applications/enums/index.rst.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Classes
1717
Module Contents
1818
---------------
1919

20-
.. py:class:: OnSchemaBreak(*args, **kwds)
20+
.. py:class:: OnSchemaBreak
2121
2222
Bases: :py:obj:`enum.Enum`
2323

@@ -49,7 +49,7 @@ Module Contents
4949

5050

5151

52-
.. py:class:: OnUpdate(*args, **kwds)
52+
.. py:class:: OnUpdate
5353
5454
Bases: :py:obj:`enum.Enum`
5555

@@ -89,7 +89,7 @@ Module Contents
8989

9090

9191

92-
.. py:class:: OperationPerformed(*args, **kwds)
92+
.. py:class:: OperationPerformed
9393
9494
Bases: :py:obj:`enum.Enum`
9595

docs/html/_sources/autoapi/algokit_utils/protocols/typed_clients/index.rst.txt

+4-8
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ Module Contents
3030
...
3131

3232
Such classes are primarily used with static type checkers that recognize
33-
structural subtyping (static duck-typing).
34-
35-
For example::
33+
structural subtyping (static duck-typing), for example::
3634

3735
class C:
3836
def meth(self) -> int:
@@ -48,7 +46,7 @@ Module Contents
4846
only the presence of given attributes, ignoring their type signatures.
4947
Protocol classes can be generic, they are defined as::
5048

51-
class GenProto[T](Protocol):
49+
class GenProto(Protocol[T]):
5250
def meth(self) -> T:
5351
...
5452

@@ -77,9 +75,7 @@ Module Contents
7775
...
7876

7977
Such classes are primarily used with static type checkers that recognize
80-
structural subtyping (static duck-typing).
81-
82-
For example::
78+
structural subtyping (static duck-typing), for example::
8379

8480
class C:
8581
def meth(self) -> int:
@@ -95,7 +91,7 @@ Module Contents
9591
only the presence of given attributes, ignoring their type signatures.
9692
Protocol classes can be generic, they are defined as::
9793

98-
class GenProto[T](Protocol):
94+
class GenProto(Protocol[T]):
9995
def meth(self) -> T:
10096
...
10197

docs/html/autoapi/algokit_utils/applications/enums/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ <h2>Classes<a class="headerlink" href="#classes" title="Link to this heading">¶
342342
<h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to this heading"></a></h2>
343343
<dl class="py class">
344344
<dt class="sig sig-object py" id="algokit_utils.applications.enums.OnSchemaBreak">
345-
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">algokit_utils.applications.enums.</span></span><span class="sig-name descname"><span class="pre">OnSchemaBreak</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#algokit_utils.applications.enums.OnSchemaBreak" title="Link to this definition"></a></dt>
345+
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">algokit_utils.applications.enums.</span></span><span class="sig-name descname"><span class="pre">OnSchemaBreak</span></span><a class="headerlink" href="#algokit_utils.applications.enums.OnSchemaBreak" title="Link to this definition"></a></dt>
346346
<dd><p>Bases: <code class="xref py py-obj docutils literal notranslate"><span class="pre">enum.Enum</span></code></p>
347347
<p>Action to take if an Application’s schema has breaking changes</p>
348348
<dl class="py attribute">
@@ -367,7 +367,7 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
367367

368368
<dl class="py class">
369369
<dt class="sig sig-object py" id="algokit_utils.applications.enums.OnUpdate">
370-
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">algokit_utils.applications.enums.</span></span><span class="sig-name descname"><span class="pre">OnUpdate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#algokit_utils.applications.enums.OnUpdate" title="Link to this definition"></a></dt>
370+
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">algokit_utils.applications.enums.</span></span><span class="sig-name descname"><span class="pre">OnUpdate</span></span><a class="headerlink" href="#algokit_utils.applications.enums.OnUpdate" title="Link to this definition"></a></dt>
371371
<dd><p>Bases: <code class="xref py py-obj docutils literal notranslate"><span class="pre">enum.Enum</span></code></p>
372372
<p>Action to take if an Application has been updated</p>
373373
<dl class="py attribute">
@@ -398,7 +398,7 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
398398

399399
<dl class="py class">
400400
<dt class="sig sig-object py" id="algokit_utils.applications.enums.OperationPerformed">
401-
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">algokit_utils.applications.enums.</span></span><span class="sig-name descname"><span class="pre">OperationPerformed</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#algokit_utils.applications.enums.OperationPerformed" title="Link to this definition"></a></dt>
401+
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">algokit_utils.applications.enums.</span></span><span class="sig-name descname"><span class="pre">OperationPerformed</span></span><a class="headerlink" href="#algokit_utils.applications.enums.OperationPerformed" title="Link to this definition"></a></dt>
402402
<dd><p>Bases: <code class="xref py py-obj docutils literal notranslate"><span class="pre">enum.Enum</span></code></p>
403403
<p>Describes the actions taken during deployment</p>
404404
<dl class="py attribute">

docs/html/autoapi/algokit_utils/protocols/typed_clients/index.html

+4-6
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
349349
</pre></div>
350350
</div>
351351
<p>Such classes are primarily used with static type checkers that recognize
352-
structural subtyping (static duck-typing).</p>
353-
<p>For example:</p>
352+
structural subtyping (static duck-typing), for example:</p>
354353
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">C</span><span class="p">:</span>
355354
<span class="k">def</span><span class="w"> </span><span class="nf">meth</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
356355
<span class="k">return</span> <span class="mi">0</span>
@@ -365,7 +364,7 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
365364
&#64;typing.runtime_checkable act as simple-minded runtime protocols that check
366365
only the presence of given attributes, ignoring their type signatures.
367366
Protocol classes can be generic, they are defined as:</p>
368-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">GenProto</span><span class="p">[</span><span class="n">T</span><span class="p">](</span><span class="n">Protocol</span><span class="p">):</span>
367+
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">GenProto</span><span class="p">(</span><span class="n">Protocol</span><span class="p">[</span><span class="n">T</span><span class="p">]):</span>
369368
<span class="k">def</span><span class="w"> </span><span class="nf">meth</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">T</span><span class="p">:</span>
370369
<span class="o">...</span>
371370
</pre></div>
@@ -394,8 +393,7 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
394393
</pre></div>
395394
</div>
396395
<p>Such classes are primarily used with static type checkers that recognize
397-
structural subtyping (static duck-typing).</p>
398-
<p>For example:</p>
396+
structural subtyping (static duck-typing), for example:</p>
399397
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">C</span><span class="p">:</span>
400398
<span class="k">def</span><span class="w"> </span><span class="nf">meth</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
401399
<span class="k">return</span> <span class="mi">0</span>
@@ -410,7 +408,7 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
410408
&#64;typing.runtime_checkable act as simple-minded runtime protocols that check
411409
only the presence of given attributes, ignoring their type signatures.
412410
Protocol classes can be generic, they are defined as:</p>
413-
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">GenProto</span><span class="p">[</span><span class="n">T</span><span class="p">](</span><span class="n">Protocol</span><span class="p">):</span>
411+
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">GenProto</span><span class="p">(</span><span class="n">Protocol</span><span class="p">[</span><span class="n">T</span><span class="p">]):</span>
414412
<span class="k">def</span><span class="w"> </span><span class="nf">meth</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">T</span><span class="p">:</span>
415413
<span class="o">...</span>
416414
</pre></div>

docs/html/searchindex.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/algokit_utils/accounts/account_manager.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
)
3333
from algokit_utils.transactions.transaction_sender import SendSingleTransactionResult
3434

35-
logger = config.logger
36-
3735
__all__ = [
3836
"AccountInformation",
3937
"AccountManager",
@@ -595,7 +593,7 @@ def rekey_account( # noqa: PLR0913
595593
self.rekeyed(sender=account, account=rekey_to)
596594

597595
if not suppress_log:
598-
logger.info(f"Rekeyed {sender_address} to {rekey_address} via transaction {result.tx_ids[-1]}")
596+
config.logger.info(f"Rekeyed {sender_address} to {rekey_address} via transaction {result.tx_ids[-1]}")
599597

600598
return result
601599

src/algokit_utils/accounts/kmd_account_manager.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
__all__ = ["KmdAccount", "KmdAccountManager"]
1313

14-
logger = config.logger
15-
1614

1715
class KmdAccount(SigningAccount):
1816
"""Account retrieved from KMD with signing capabilities, extending base Account.
@@ -121,7 +119,7 @@ def get_or_create_wallet_account(self, name: str, fund_with: AlgoAmount | None =
121119
account = self.get_wallet_account(name)
122120
assert account is not None
123121

124-
logger.info(
122+
config.logger.info(
125123
f"LocalNet account '{name}' doesn't yet exist; created account {account.address} "
126124
f"with keys stored in KMD and funding with {fund_with} ALGO"
127125
)

src/algokit_utils/applications/app_deployer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ def _handle_update(
640640
extra={"suppress_log": suppress_log},
641641
)
642642
else:
643-
config.logger.info(
643+
config.logger.warning(
644644
"App is not updatable but on_update=UpdateApp, will attempt to update app, "
645645
"update will most likely fail",
646646
extra={"suppress_log": suppress_log},
@@ -649,12 +649,12 @@ def _handle_update(
649649

650650
if deployment.on_update in (OnUpdate.ReplaceApp, "replace"):
651651
if existing_app.deletable:
652-
config.logger.info(
652+
config.logger.warning(
653653
"App is deletable and on_update=ReplaceApp, will attempt to create new app and delete old app",
654654
extra={"suppress_log": suppress_log},
655655
)
656656
else:
657-
config.logger.info(
657+
config.logger.warning(
658658
"App is not deletable but on_update=ReplaceApp, will attempt to create a new app and "
659659
"delete the old app, delete will most likely fail",
660660
extra={"suppress_log": suppress_log},

src/algokit_utils/clients/dispenser_api_client.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
]
2323

2424

25-
logger = config.logger
26-
27-
2825
class DispenserApiConfig:
2926
BASE_URL = "https://api.dispenser.algorandfoundation.tools"
3027

@@ -141,7 +138,7 @@ def _process_dispenser_request(
141138

142139
except Exception as err:
143140
error_message = "Error processing dispenser API request"
144-
logger.debug(f"{error_message}: {err}", exc_info=True)
141+
config.logger.debug(f"{error_message}: {err}", exc_info=True)
145142
raise err
146143

147144
@overload
@@ -182,7 +179,7 @@ def fund(self, address: str, amount: int, asset_id: int | None = None) -> Dispen
182179
return DispenserFundResponse(tx_id=content["txID"], amount=content["amount"])
183180

184181
except Exception as err:
185-
logger.exception(f"Error funding account {address}: {err}")
182+
config.logger.exception(f"Error funding account {address}: {err}")
186183
raise err
187184

188185
def refund(self, refund_txn_id: str) -> None:
@@ -199,7 +196,7 @@ def refund(self, refund_txn_id: str) -> None:
199196
)
200197

201198
except Exception as err:
202-
logger.exception(f"Error issuing refund for txn_id {refund_txn_id}: {err}")
199+
config.logger.exception(f"Error issuing refund for txn_id {refund_txn_id}: {err}")
203200
raise err
204201

205202
def get_limit(
@@ -220,5 +217,5 @@ def get_limit(
220217

221218
return DispenserLimitResponse(amount=content["amount"])
222219
except Exception as err:
223-
logger.exception(f"Error setting limit for account {address}: {err}")
220+
config.logger.exception(f"Error setting limit for account {address}: {err}")
224221
raise err

src/algokit_utils/transactions/transaction_composer.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@
7575
]
7676

7777

78-
logger = config.logger
79-
8078
MAX_TRANSACTION_GROUP_SIZE = 16
8179
MAX_APP_CALL_FOREIGN_REFERENCES = 8
8280
MAX_APP_CALL_ACCOUNT_REFERENCES = 4
@@ -1220,11 +1218,11 @@ def send_atomic_transaction_composer( # noqa: C901, PLR0912
12201218
)
12211219

12221220
if not suppress_log:
1223-
logger.info(
1221+
config.logger.info(
12241222
f"Sending group of {len(transactions_to_send)} transactions ({group_id})",
12251223
extra={"suppress_log": suppress_log or False},
12261224
)
1227-
logger.debug(
1225+
config.logger.debug(
12281226
f"Transaction IDs ({group_id}): {[t.get_txid() for t in transactions_to_send]}",
12291227
extra={"suppress_log": suppress_log or False},
12301228
)
@@ -1244,12 +1242,12 @@ def send_atomic_transaction_composer( # noqa: C901, PLR0912
12441242
# Log results
12451243
if not suppress_log:
12461244
if len(transactions_to_send) > 1:
1247-
logger.info(
1245+
config.logger.info(
12481246
f"Group transaction ({group_id}) sent with {len(transactions_to_send)} transactions",
12491247
extra={"suppress_log": suppress_log or False},
12501248
)
12511249
else:
1252-
logger.info(
1250+
config.logger.info(
12531251
f"Sent transaction ID {transactions_to_send[0].get_txid()}",
12541252
extra={"suppress_log": suppress_log or False},
12551253
)
@@ -1271,7 +1269,7 @@ def send_atomic_transaction_composer( # noqa: C901, PLR0912
12711269
except Exception as e:
12721270
# Handle error with debug info if enabled
12731271
if config.debug:
1274-
logger.error(
1272+
config.logger.error(
12751273
"Received error executing Atomic Transaction Composer and debug flag enabled; "
12761274
"attempting simulation to get more information ",
12771275
extra={"suppress_log": suppress_log or False},
@@ -1307,7 +1305,7 @@ def send_atomic_transaction_composer( # noqa: C901, PLR0912
13071305
error.traces = traces # type: ignore[attr-defined]
13081306
raise error from e
13091307

1310-
logger.error(
1308+
config.logger.error(
13111309
"Received error executing Atomic Transaction Composer, for more information enable the debug flag",
13121310
extra={"suppress_log": suppress_log or False},
13131311
exc_info=e,

src/algokit_utils/transactions/transaction_sender.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
"SendSingleTransactionResult",
4646
]
4747

48-
logger = config.logger
49-
5048

5149
TxnParamsT = TypeVar("TxnParamsT", bound=TxnParams)
5250

@@ -213,7 +211,7 @@ def send_transaction(params: TxnParamsT, send_params: SendParams | None = None)
213211

214212
if pre_log:
215213
transaction = composer.build().transactions[-1].txn
216-
logger.debug(pre_log(params, transaction))
214+
config.logger.debug(pre_log(params, transaction))
217215

218216
raw_result = composer.send(
219217
send_params,
@@ -230,7 +228,7 @@ def send_transaction(params: TxnParamsT, send_params: SendParams | None = None)
230228
)
231229

232230
if post_log:
233-
logger.debug(post_log(params, result))
231+
config.logger.debug(post_log(params, result))
234232

235233
return result
236234

0 commit comments

Comments
 (0)