Metadata-Version: 2.1
Name: cs.app.dlog
Version: 20240305
Summary: Log a line in my daily log.
Author-email: Cameron Simpson <cs@cskk.id.au>
License: GNU General Public License v3 or later (GPLv3+)
Project-URL: URL, https://bitbucket.org/cameron_simpson/css/commits/all
Keywords: python3
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Topic :: System :: Logging
Classifier: Topic :: Utilities
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Description-Content-Type: text/markdown
Requires-Dist: arrow
Requires-Dist: cs.buffer>=20240201
Requires-Dist: cs.cmdutils>=20240211
Requires-Dist: cs.context>=20240212.1
Requires-Dist: cs.dateutils>=20230210
Requires-Dist: cs.deco>=20240303
Requires-Dist: cs.fstags>=20240211
Requires-Dist: cs.lex>=20240211
Requires-Dist: cs.logutils>=20230212
Requires-Dist: cs.pfx>=20230604
Requires-Dist: cs.progress>=20230401
Requires-Dist: cs.queues>=20240305
Requires-Dist: cs.resources>=20240201
Requires-Dist: cs.sqltags>=20240305
Requires-Dist: cs.tagset>=20240305
Requires-Dist: cs.upd>=20240216
Requires-Dist: icontract
Requires-Dist: typeguard

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 `Tag`s 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.
