Skip to main content

By this command line tool, you can run a python repl which logs everying into a file.

Project description

Usage

Install:

pip install logrepl

run the repl:

pylogrepl

then the whole repl will be logged to the file yyyymmddhhmm.log.

Config

Prefix of the log file

use the optional positional argument, for example:

pylogrepl prefix

then the log file will be prefix_yyyymmddhhmm.log.

Dir to save the logs

use the -d or --dir options:

pylogrepl -d logs
pylogrepl --dir logs

then the log file will be in the logs directory.

By .pylogrepl file

You can also sepcify the prefix & the directory by making a .pylogrepl in the working directory:

dir=logs
prefix=my_prefix

note that the command line arguments are prioritized over the settings in .pylogrepl. We suggest that specifying dir in .pylogrepl and prefix by command line argument is a handy approach.

APIs

By executing pylogrepl, the module logrepl will be loaded to the current namespace.

update logging dir / file

logrepl.update(prefix=None, new_dir=None)

update new logging dir & new prefix. Logs will be written to a new yyyymmddhhmm.log even no arguments are provided.

start / stop logging to file

logrepl.start_log()

start logging to the file.

logrepl.stop_log()

stop logging to the file.

Handler

logrepl.repl_handler

the Handler object that controls the logging behavior of the repl.

Notes

Exceptions ocurred when writing to the log file will not be logged since it'll lead to infinite loop.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logrepl-0.1.7.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

logrepl-0.1.7-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page