Skip to main content

Log a line in my daily log.

Project description

Log a line in my daily log.

Latest release 20240305: Initial PyPI release.

This is an upgrade from my venerable shell script, whose logic was becoming unwieldy.

I more or less live in the shell, so I log activity with brief 1-line shell command commands eg:

dlog HOME: set up the whatchamgig

which I alias as dl, with additional aliases like HOME for dl HOME: and so forth; as short a throwaway line as I can get away with. In particular, I use this to make notes about work activity (none of the several time tracking tools I've tried work for me) and things like banking and purchases eg:

dl MYBANK,VENDOR: xfer \$99 to vendor for widget from bank acct rcpt 1234567

I've got scripts to pull out the work ones for making invoices and an assortment of other scripts (eg my alert script) also log via dlog.

The current incarnation logs to a flat text file (default ~/var/dlog-quick) and to SQLTags SQLite database. It has a little daemon mode to reduce contention for the SQLite database too.

Class DLog

A log entry.

Function dlog(headline: str, *, logpath: Optional[str] = None, sqltags: Optional[cs.sqltags.SQLTags] = '~/var/sqltags.sqlite', tags=None, categories: Optional[Iterable] = None, when: Union[NoneType, int, float, datetime.datetime] = None)

Log headline to the dlog.

Parameters:

  • headline: the log line message
  • logpath: optional text log pathname, default ~/var/log/dlog-quick from DEFAULT_LOGPATH
  • sqltags: optional SQLTags instance, default uses ~/var/sqltags.sqlite from DEFAULT_DBPATH
  • tags: optional iterable of Tags to associate with the log entry
  • categories: optional iterable of category strings
  • when: optional UNIX time or datetime, default now

Class DLogCommand(cs.cmdutils.BaseCommand)

The dlog command line implementation.

Command line usage:

Usage: dlog subcommand [...]
  Subcommands:
    daemon [pipepath]
      Listen on pipepath for new dlog messages.
      This serialises contention for the database.
    help [-l] [subcommand-names...]
      Print help for subcommands.
      This outputs the full help for the named subcommands,
      or the short help for all subcommands if no names are specified.
      -l  Long help even if no subcommand-names provided.
    log [{CATEGORIES:|tag=value}...] headline
      Log headline to the dlog.
      Options:
      -c categories   Alternate categories specification.
      -d datetime     Timestamp for the log entry instead of "now".
    scan [{-|filename}]...
      Scan log files and report.
    shell
      Run a command prompt via cmd.Cmd using this command's subcommands.

Function main(argv=None)

Run the dlog command line implementation.

Release Log

Release 20240305: Initial PyPI release.

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

cs.app.dlog-20240305.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

cs.app.dlog-20240305-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file cs.app.dlog-20240305.tar.gz.

File metadata

  • Download URL: cs.app.dlog-20240305.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for cs.app.dlog-20240305.tar.gz
Algorithm Hash digest
SHA256 43fc3f7b64a1a93938827c7db6f3292c75e6d0eb688b2794ab111a5689b3d3ff
MD5 5fed4875b004a6ce4f78af3979668654
BLAKE2b-256 99865e7bd9322ffa0985c8de0d3210ccecaee5e666f9058cfc4a05e94e1cf521

See more details on using hashes here.

File details

Details for the file cs.app.dlog-20240305-py3-none-any.whl.

File metadata

File hashes

Hashes for cs.app.dlog-20240305-py3-none-any.whl
Algorithm Hash digest
SHA256 727b1535e4bb1403baae6252c344d4167b2d004bd8dd2923347ea3697f9111f1
MD5 bd873a1966baa70d352c72c53f111c72
BLAKE2b-256 fdb3b5772e653d94fd5af8983e6d03fc88552536f14dcb0273cc4c21dbac0b57

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