Printing
Printing¶
arc exports several functions to be used when printing things to the screen:
arc.print()
- Wrapper around the normal print function that is aware of whether or not stdout is the terminal or not. If it not a terminal, all escape codes will be removed.arc.info()
- Wrapper aroundarc.print()
, but writes to stderr instead of stdout. Useful for quick logging purposesarc.err()
- Wrapper aroundarc.print()
, but writes to stderr instead of stdout and styled as an error.arc.log()
- Wrapper aroundarc.print()
, but writes to stderr instead of stdout and includes a timestamp.
Logging¶
arc has a logger setup that will change it's level based on the current enviroment.
import arc
# Uncomment the below line for the log to
# print to the screen.
# arc.configure(enviroment="development")
@arc.command
def command(ctx: Context):
ctx.logger.info('hello there!')
command()
The levels are:
- development:
INFO
- production:
WARNING
You can also set the level to DEBUG
by setting arc.configure(debug=True)
, which takes priority over the enviroment. Note that this will start printing out arc's own debug statements