mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +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
|
#!/usr/bin/env python
|
||||||
import manimlib.config
|
import manimlib.config
|
||||||
|
import manimlib.logger
|
||||||
import manimlib.extract_scene
|
import manimlib.extract_scene
|
||||||
import manimlib.utils.init_config
|
import manimlib.utils.init_config
|
||||||
from manimlib import __version__
|
from manimlib import __version__
|
||||||
|
@ -11,6 +12,8 @@ def main():
|
||||||
args = manimlib.config.parse_cli()
|
args = manimlib.config.parse_cli()
|
||||||
if args.version and args.file == None:
|
if args.version and args.file == None:
|
||||||
return
|
return
|
||||||
|
if args.log_level:
|
||||||
|
manimlib.logger.log.setLevel(args.log_level)
|
||||||
|
|
||||||
if args.config:
|
if args.config:
|
||||||
manimlib.utils.init_config.init_customization()
|
manimlib.utils.init_config.init_customization()
|
||||||
|
|
|
@ -142,6 +142,10 @@ def parse_cli():
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Display the version of manimgl"
|
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()
|
args = parser.parse_args()
|
||||||
return args
|
return args
|
||||||
except argparse.ArgumentError as err:
|
except argparse.ArgumentError as err:
|
||||||
|
|
|
@ -6,7 +6,8 @@ __all__ = ["log"]
|
||||||
|
|
||||||
FORMAT = "%(message)s"
|
FORMAT = "%(message)s"
|
||||||
logging.basicConfig(
|
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