mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
add cli flag to specify log level
This commit is contained in:
parent
b6c23a09e9
commit
e10f850d0d
3 changed files with 10 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
import manimlib.config
|
||||
import manimlib.logger
|
||||
import manimlib.extract_scene
|
||||
import manimlib.utils.init_config
|
||||
from manimlib import __version__
|
||||
|
@ -11,6 +12,8 @@ def main():
|
|||
args = manimlib.config.parse_cli()
|
||||
if args.version and args.file == None:
|
||||
return
|
||||
if args.log_level:
|
||||
manimlib.logger.log.setLevel(args.log_level)
|
||||
|
||||
if args.config:
|
||||
manimlib.utils.init_config.init_customization()
|
||||
|
|
|
@ -142,6 +142,10 @@ def parse_cli():
|
|||
action="store_true",
|
||||
help="Display the version of manimgl"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--log-level",
|
||||
help="Level of messages to Display, can be DEBUG / INFO / WARNING / ERROR / CRITICAL"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
except argparse.ArgumentError as err:
|
||||
|
|
|
@ -6,7 +6,8 @@ __all__ = ["log"]
|
|||
|
||||
FORMAT = "%(message)s"
|
||||
logging.basicConfig(
|
||||
level="NOTSET", format=FORMAT, datefmt="[%X]", handlers=[RichHandler()]
|
||||
level=logging.WARNING, format=FORMAT, datefmt="[%X]", handlers=[RichHandler()]
|
||||
)
|
||||
|
||||
log = logging.getLogger("rich")
|
||||
log = logging.getLogger("manimgl")
|
||||
log.setLevel("DEBUG")
|
||||
|
|
Loading…
Add table
Reference in a new issue