Skip to main content

MatLab style commands logger for the Python interpreter

Project description

pydiary

MatLab style commands logger for the Python interpreter, with added features.

Usage

Import the Diary class from the package and create a new instance. The commands you type in from now on will be logged into a file. Call diary.off() to disable logging.

from pydiary import Diary

Diary()                 # Turns diary on, saving commands to the default file diary.py

...

# The current active diary is automatically assigned to a variable called "diary"
diary.off()             # Turns diary off

You can pass a custom path for the diary file and save the instance to re-enable it afterwards:

# Turns diary on, saving commands to a file called mydiary.py in the current directory
my_diary = Diary('mydiary.py')      # You can save a reference to the Diary instance to use it later

...

my_diary.off()

...

my_diary.on()           # Turns on the previously created diary

Advanced usage

Buffered mode

By default pydiary uses an internal string buffer to keep the diary file free for manual changes, and only writes to it when you turn off the diary. You can force pydiary to flush commands to the file by calling diary.flush().

Call diary.discard() if you want to discard all commands not yet written to the diary file.

Direct mode

You can force pydiary to operate in direct mode by setting the buffered parameter to False when creating an instance.

Diary(buffered=False)

In this mode pydiary will write commands directly to the diary file. Note that due to the way Python handles writing to files, the commands may not be written immediately and you may still need to call diary.off() to see them in the file.

Improvement, Issues report

Suggest improvements or features, report bugs at https://github.com/nathanlepori/pydiary/issues

Authors

  • Nathan Lepori

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

pydiary-1.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydiary-1.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pydiary-1.1.0.tar.gz.

File metadata

  • Download URL: pydiary-1.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for pydiary-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5cfba62a7827128ed04872c65f63b119aa7355b678fb0f3898c790a03848e30c
MD5 29d5d7aff07fdb64fb5513397e305071
BLAKE2b-256 832401e767904e88b92919850d3d1733756a90e660ec5295c1b2ea0a1b474754

See more details on using hashes here.

File details

Details for the file pydiary-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydiary-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for pydiary-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e255e17639c4fa56dc77bec96391a1040996e2d762b30200e48ee3368f09a8cd
MD5 6ffcb71cbd5c9bca3009f4abb3ec7eeb
BLAKE2b-256 66f84be48922c5db18a0e64f88210361634c747fdc3bebe767a8c5e72b973e0f

See more details on using hashes here.

Supported by

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