diff --git a/README.md b/README.md index c2968ef..0487359 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # pflog -[![Version](https://img.shields.io/docker/v/fnndsc/pl-pflog?sort=semver)](https://hub.docker.com/r/fnndsc/pl-pflog) -[![MIT License](https://img.shields.io/github/license/fnndsc/pl-pflog)](https://github.com/FNNDSC/pl-pflog/blob/main/LICENSE) -[![ci](https://github.com/FNNDSC/pl-pflog/actions/workflows/ci.yml/badge.svg)](https://github.com/FNNDSC/pl-pflog/actions/workflows/ci.yml) +[![Version](https://img.shields.io/docker/v/fnndsc/pflog?sort=semver)](https://hub.docker.com/r/fnndsc/pflog) +[![MIT License](https://img.shields.io/github/license/fnndsc/pflog)](https://github.com/FNNDSC/pflog/blob/main/LICENSE) +[![ci](https://github.com/FNNDSC/pflog/actions/workflows/ci.yml/badge.svg)](https://github.com/FNNDSC/pflog/actions/workflows/build.yml) ## Abstract @@ -31,11 +31,38 @@ docker pull fnndsc/pflog ## Runnning -The simplest way to use `pflog` in script mode is +### Script mode + +To use `pflog` in script mode you simply call the script with appropriate arguments (and of course this assumes you have a server isntance at the `$PFTEL` location) ```bash export PFTEL=http://localhost:22223 # obviously change this as needed -pflog --pftelURL $PFTEL --verbosity 1 --log "Hello world!" + +pflog \ + --log "Hello, world!" \ + --pftelURL $PFTEL \ + --verbosity 1 \ +``` + +### Module mode + +To use `pflog` in python module mode, you declare an object and instantiate with a dictionary of values. The dictionary keys are _identical_ to the script CLI keys: + +```python +from pflog import pflog + +log:pflog.Pflog = pflog.Pflog( { + 'log' : 'Hello, world!', + 'pftelURL' : 'http://localhost:22223', + 'verbosity' : '1' + } +) +d_tlog:dict = log.run() + +# You can use this same object to log more messages: +log('This is another message') +log('and so is this!') + ``` This writes messages to default `logObject` under a `logCollection` that is the timestamp of the event transmission. Within the `logCollection` will be single `logEvent` called `000-event`. diff --git a/README.rst b/README.rst index 10a4751..e02a1e1 100644 --- a/README.rst +++ b/README.rst @@ -39,12 +39,44 @@ docker container Runnning -------- -The simplest way to use ``pflog`` in script mode is +Script mode +~~~~~~~~~~~ + +To use ``pflog`` in script mode you simply call the script with +appropriate arguments (and of course this assumes you have a server +isntance at the ``$PFTEL`` location) .. code:: bash export PFTEL=http://localhost:22223 # obviously change this as needed - pflog --pftelURL $PFTEL --verbosity 1 --log "Hello world!" + + pflog \ + --log "Hello, world!" \ + --pftelURL $PFTEL \ + --verbosity 1 \ + +Module mode +~~~~~~~~~~~ + +To use ``pflog`` in python module mode, you declare an object and +instantiate with a dictionary of values. The dictionary keys are +*identical* to the script CLI keys: + +.. code:: python + + from pflog import pflog + + log:pflog.Pflog = pflog.Pflog( { + 'log' : 'Hello, world!', + 'pftelURL' : 'http://localhost:22223', + 'verbosity' : '1' + } + ) + d_tlog:dict = log.run() + + # You can use this same object to log more messages: + log('This is another message') + log('and so is this!') This writes messages to default ``logObject`` under a ``logCollection`` that is the timestamp of the event transmission. Within the @@ -139,9 +171,9 @@ Run unit tests using ``pytest``. Coming soon! *-30-* -.. |Version| image:: https://img.shields.io/docker/v/fnndsc/pl-pflog?sort=semver - :target: https://hub.docker.com/r/fnndsc/pl-pflog -.. |MIT License| image:: https://img.shields.io/github/license/fnndsc/pl-pflog - :target: https://github.com/FNNDSC/pl-pflog/blob/main/LICENSE -.. |ci| image:: https://github.com/FNNDSC/pl-pflog/actions/workflows/ci.yml/badge.svg - :target: https://github.com/FNNDSC/pl-pflog/actions/workflows/ci.yml +.. |Version| image:: https://img.shields.io/docker/v/fnndsc/pflog?sort=semver + :target: https://hub.docker.com/r/fnndsc/pflog +.. |MIT License| image:: https://img.shields.io/github/license/fnndsc/pflog + :target: https://github.com/FNNDSC/pflog/blob/main/LICENSE +.. |ci| image:: https://github.com/FNNDSC/pflog/actions/workflows/ci.yml/badge.svg + :target: https://github.com/FNNDSC/pflog/actions/workflows/build.yml