Skip to content

Commit

Permalink
pypi package metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Omri Eival committed Apr 21, 2018
1 parent d7c6036 commit ef000b8
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 0 deletions.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Logging S3 Handler

A python logging handler that streams lines to Aws S3 objects

## Getting Started

### Prerequisites

Asynchronous multipart uploading relies on gevent greenlets

```
boto3
gevent >= 1.2.2
```

### Installing

Installation using pip

```
pip install logging_s3_handler
```

## Running the tests

```
To Do
```

### Examples
Stream log records to S3
```
from logging_s3_handler import S3Handler
KEY_ID="your_aws_auth_key"
SECRET="your_aws_auth_secret"
bucket="test_bucket" # The bucket should already exist
handler = S3Handler("test_log", bucket, KEY_ID, SECRET)
formatter = logging.Formatter('[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger = logging.getLogger('root')
logger.setLevel(logging.INFO)
logger.addHandler(handler)
for i in range(0, 100000):
logger.info("test info message")
logger.warning("test warning message")
logger.error("test error message")
```

## Contributing

Feel free to contact me for feature requests, improvements, participation questions and what not
[email protected]

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details

## Acknowledgments

* Some of the code seen here was inspired by the smart_open package, which I considered utilizing for my purposes but decided to code my own way to match my exact needs

4 changes: 4 additions & 0 deletions S3StreamHandler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
__author__ = 'Omri Eival'
__version__ = '0.1.1'

from logging import StreamHandler
from io import BufferedIOBase, BytesIO
from boto3 import Session
from datetime import datetime

import signal
import gevent

Expand Down
4 changes: 4 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__author__ = 'Omri Eival'
__version__ = '0.1.1'

from S3StreamHandler import S3Handler
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
18 changes: 18 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from distutils.core import setup

setup(
name='logging_s3_handler',
packages=['logging_s3_handler'],
version='0.1.1',
description='A logging handler that streams log records to Aws S3 objects',
author='Omri Eival',
author_email='[email protected]',
url='https://github.com/omrikiei/logging_s3_handler/',
download_url='https://github.com/omrikiei/logging_s3_handler/archive/0.1.tar.gz',
keywords=['logging', 's3', 'aws', 'handler'],
classifiers=[],
install_requires=[
'boto3',
'gevent >= 1.2.2'
],
)

0 comments on commit ef000b8

Please sign in to comment.