From dff9121c9a0619d3aff46dab5d08a279211f9930 Mon Sep 17 00:00:00 2001 From: bradrf Date: Tue, 27 Dec 2016 20:11:49 -0800 Subject: [PATCH] update code example w/ config object for bookmarks --- README.rst | 2 +- docs/usage.rst | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index d645dc1..62c1009 100644 --- a/README.rst +++ b/README.rst @@ -76,7 +76,7 @@ It's safe to rerun s3tail sessions when working with piped commands searching fo always read and display from the cache before downloading from S3. This is done in a best-effort background thread to avoid impacting performance. The file cache is stored in the user's ``HOME`` directory, in an ``.s3tailcache`` subdirectory, where the file names are the S3 keys hashed with -SHA-256. These can be listed by through the use of the ``--cache-lookup`` option: +SHA-256. These can be listed through the use of the ``--cache-lookup`` option: .. code-block:: console diff --git a/docs/usage.rst b/docs/usage.rst index 8a20b21..199e16e 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -82,14 +82,18 @@ Basic Console Example Coding Example -------------- -To use the :class:`.s3tail.S3Tail` class in a project:: +To use the :class:`.s3tail.S3Tail` class in a project: + +.. code-block:: python from s3tail import S3Tail + from configparser import ConfigParser def process_line(num, line): print '%d: %s' % (num, line) - tail = S3Tail('my-logs', 'production-s3-access-2016-08-04', process_line) + config = ConfigParser() # stores the bookmarks + tail = S3Tail(config, 'my-logs', 'production-s3-access-2016-08-04', process_line) tail.watch() tail.cleanup()