Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Logging section
Tom Scavo committed Jun 11, 2017
1 parent e945268 commit 51738e1
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions README.md
@@ -45,23 +45,22 @@ saml_tools.sh

## Environment

Besides `BIN_DIR` and `LIB_DIR` above, the following environment variables are required:
Besides `BIN_DIR` and `LIB_DIR` above, the scripts leverage the following environment variables:

| Variable | |
| --- | --- |
| `CACHE_DIR` | A persistent HTTP cache |
| `TMPDIR` | A temporary directory |
| `LOG_FILE` | A persistent log file |
| `LOG_LEVEL` | The global log level [0..5] |

Some OSes define `TMPDIR` and some do not. In any case, a temporary directory is required to use these scripts.
All but `LOG_LEVEL` are REQUIRED. See the following section for more info about logging.

## Overview
Note: Some OSes define `TMPDIR` and some do not. In any case, a temporary directory is required to use these scripts.

### `cget.sh`
## Logging

Bash script `cget.sh` retrieves and caches HTTP resources on disk. A previously cached resource is retrieved via HTTP Conditional GET [RFC 7232]. If the web server responds with HTTP 200 OK, the resource is cached and written to stdout. If the web server responds with 304 Not Modified, the cached resource is output instead.

First let's configure logging. For convenience, we will log directly to the terminal:
For convenience, we will log directly to the terminal:

```Shell
$ export LOG_FILE=/dev/tty
@@ -79,9 +78,15 @@ Various log levels are supported:
| ERROR | 1 |
| FATAL | 0 |

The default logging level is INFO (i.e., if you do not explicitly set the `LOG_LEVEL` environment variable, the value `LOG_LEVEL=3` is assumed by default).
The default logging level is INFO (i.e., if you do not explicitly set the optional `LOG_LEVEL` environment variable, the value `LOG_LEVEL=3` is assumed by default).

## Overview

### `cget.sh`

Bash script `cget.sh` retrieves and caches HTTP resources on disk. A previously cached resource is retrieved via HTTP Conditional GET [RFC 7232]. If the web server responds with HTTP 200 OK, the resource is cached and written to stdout. If the web server responds with 304 Not Modified, the cached resource is output instead.

Next we define a couple of HTTP resources and a cache:
First define a couple of HTTP resources and a cache:

```Shell
$ url1=http://md.incommon.org/InCommon/InCommon-metadata-preview.xml

0 comments on commit 51738e1

Please sign in to comment.