aboutsummaryrefslogtreecommitdiff
path: root/docs/refman/generatorprint.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-11-18 13:25:12 -0800
committerEli Schwartz <eschwartz@archlinux.org>2023-05-31 17:20:44 -0400
commitada2a976f003f505181d2f252ef907f8caa345e0 (patch)
tree547aac75202aa63aec5688e5c064f80ca43cf557 /docs/refman/generatorprint.py
parent1e79553c36bf6473a58559254dc25fc550dfca99 (diff)
downloadmeson-ada2a976f003f505181d2f252ef907f8caa345e0.zip
meson-ada2a976f003f505181d2f252ef907f8caa345e0.tar.gz
meson-ada2a976f003f505181d2f252ef907f8caa345e0.tar.bz2
mlog: use a hidden class for state
This is a pretty common pattern in python (the standard library uses it a ton): A class is created, with a single private instance in the module, and then it's methods are exposed as public API. This removes the need for the global statement, and is generally a little easier to reason about thanks to encapsulation.
Diffstat (limited to 'docs/refman/generatorprint.py')
-rw-r--r--docs/refman/generatorprint.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/refman/generatorprint.py b/docs/refman/generatorprint.py
index d836091..d805296 100644
--- a/docs/refman/generatorprint.py
+++ b/docs/refman/generatorprint.py
@@ -19,7 +19,7 @@ from mesonbuild import mlog
import typing as T
def my_nested() -> T.ContextManager[None]:
- prefix = '|' * len(mlog.log_depth)
+ prefix = '|' * mlog.get_log_depth()
return mlog.nested(prefix)
class GeneratorPrint(GeneratorBase):