Skip to main content

flask/requests logging

Project description

# FRL Flask Requests Logger

[![Build Status](https://secure.travis-ci.org/balanced/frl.png?branch=master)](http://travis-ci.org/balanced/frl) [![Latest Version](https://pypip.in/version/frl/badge.svg)](https://pypi.python.org/pypi/frl/) [![Downloads](https://pypip.in/download/frl/badge.svg)](https://pypi.python.org/pypi/frl/) [![Supported Python versions](https://pypip.in/py_versions/frl/badge.svg)](https://pypi.python.org/pypi/frl/) [![License](https://pypip.in/license/frl/badge.svg)](https://pypi.python.org/pypi/frl/)

A request logger for requests and responses from the requests and flask libraries that logs in a standard format

```json
{
"meta":{

},
"request":{
"headers":[
[
"Host",
"localhost"
],
[
"Content-Length",
"0"
],
[
"Content-Type",
""
]
],
"url":"http://localhost/",
"method":"GET",
"payload": null
},
"response":{
"status":"200 OK",
"headers":[
[
"Content-Type",
"text/html; charset=utf-8"
],
[
"Content-Length",
"12"
]
],
"data":"Hello World!"
}
}
```

## Configure flask


```python
class FlaskApp(flask.Flask):

def log_it(self, response):
logger.log(response)
return response

logger = frl.server.ServerRequestLogger(
'logger-name',
['card_number', 'password']
)

app = FlaskApp(__name__)
app.after_request(app.log_it)

```


## Configure requests


```python
logger = frl.client.ClientRequestLogger(
'logger-name',
['card_number', 'password']
)
response = requests.get('http://google.com')
logger.log(response)
```

You can add additional data into the meta field.

```python
logger = frl.client.ClientRequestLogger(
'logger-name',
['card_number', 'password']
)
def meta_logger(response):
return {'foo': 'bar'}
logger.meta_population_methods.append(meta_logger)
```

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

frl-0.0.4.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file frl-0.0.4.tar.gz.

File metadata

  • Download URL: frl-0.0.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for frl-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a59ac3e947d33a84daf92b254bda1f91f2ff0fd1287cc8a8132938ab9bb8e1cf
MD5 606388af353b6df13ef0785e87cf1319
BLAKE2b-256 0fde5b9aa04356864d07e08bf2a4fb174f1ddfcea58afe32acecb03199298b05

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page