Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1209a11
chore: Initiate incomplete AI WAF
Anyesh Jun 23, 2021
3edeb7f
chore: Organize depricating imports
Anyesh Jun 23, 2021
c4c757a
chore: Move adapter to utils
Anyesh Jun 23, 2021
6faeb97
chore: Move modules in middleware and add mirrors for backward compat…
Anyesh Jun 23, 2021
51c5029
Merge branch 'master' into enhance/new-structure
Anyesh Jul 17, 2021
412be96
refactor(project-restructure): :art: Sync with current structure
Anyesh Jul 17, 2021
bb026af
refactor(project-restructure): :art: Move all utils to the utils dir
Anyesh Jul 17, 2021
4679646
refactor(project-restructure): :art: Sync utils import
Anyesh Jul 17, 2021
2087fac
new: Add init utils package
Anyesh Jul 17, 2021
fc3118e
feat(project-restructure): :sparkles: Add packages and subpackages ma…
Anyesh Jul 17, 2021
ce68c98
fix(project-restructure): :bug: Make the package path platform indepe…
Anyesh Jul 17, 2021
3696c79
refactor(project-restructure): :art: Rename utilities
Anyesh Jul 17, 2021
45b9900
docs(project-restructure): :art: Update docs for middleware
Anyesh Jul 17, 2021
4fffe70
fix(project-restructure): Append usagelogger path in tests
Anyesh Jul 23, 2021
7bfe2f4
chore: Organize depricating imports
Anyesh Jun 23, 2021
2d076ef
chore: Move adapter to utils
Anyesh Jun 23, 2021
0968310
chore: Move modules in middleware and add mirrors for backward compat…
Anyesh Jun 23, 2021
4098d14
refactor(project-restructure): :art: Sync with current structure
Anyesh Jul 17, 2021
0c730d1
refactor(project-restructure): :art: Move all utils to the utils dir
Anyesh Jul 17, 2021
3caa11a
refactor(project-restructure): :art: Sync utils import
Anyesh Jul 17, 2021
b25b257
new: Add init utils package
Anyesh Jul 17, 2021
081694f
feat(project-restructure): :sparkles: Add packages and subpackages ma…
Anyesh Jul 17, 2021
9b50a75
fix(project-restructure): :bug: Make the package path platform indepe…
Anyesh Jul 17, 2021
9257184
refactor(project-restructure): :art: Rename utilities
Anyesh Jul 17, 2021
d28d97a
docs(project-restructure): :art: Update docs for middleware
Anyesh Jul 17, 2021
46341cc
fix(project-restructure): Append usagelogger path in tests
Anyesh Jul 23, 2021
ccfdd65
Merge branch 'enhance/new-structure' of github.com:resurfaceio/logger…
Anyesh Sep 16, 2021
3f5c386
feat: Add crossplatform tests
Anyesh Sep 16, 2021
697d64b
feat: Remove pytest workflow
Anyesh Sep 16, 2021
752c6d7
feat: Use pytest only
Anyesh Sep 16, 2021
e332787
feat: Add pylintrc
Anyesh Sep 16, 2021
9560ebf
feat: Ignore wildcard import
Anyesh Sep 16, 2021
be84c59
style: Ignore wildcard imports
Anyesh Sep 16, 2021
1f319cf
feat: Move warnings to root
Anyesh Sep 16, 2021
7132a67
fix: Update warning path
Anyesh Sep 16, 2021
671cc09
feat: Ignore cookie reponse for now
Anyesh Oct 2, 2021
f352ee7
feat: Add queue and thread submission
Anyesh Oct 2, 2021
583aa95
Merge branch 'enhance/new-structure' into experimental/add-ai-waf
Anyesh Oct 20, 2021
a33a6a5
feat: Add artifacts in the package
Anyesh Oct 20, 2021
606c4a4
feat: Include artifacts dir in package
Anyesh Oct 20, 2021
d1fd4a7
feat: Add WAF in the submit section
Anyesh Oct 20, 2021
0919065
feat(background-submission): :sparkles: Add proper background submiss…
Anyesh Oct 27, 2021
9b505ce
fix(background-submission): :rewind: Re-enable session copy
Anyesh Oct 27, 2021
ba22ff8
fix(background-submission): :recycle: Move lag to a better place
Anyesh Oct 27, 2021
c82c76e
feat: Remove lag from payload
Anyesh Oct 27, 2021
3bd7a79
Merge branch 'experimental/add-ai-waf' into background-submission
Anyesh Oct 27, 2021
4c9a5f4
feat(background-submission): :zap: Merge waf to background submission
Anyesh Oct 27, 2021
c27eadc
refactor(background-submission): :mute: Remove status code log
Anyesh Oct 27, 2021
44f5a47
feat: Update requirements for WAF
Anyesh Nov 9, 2021
6df4376
fix: Join daemon thread in the end
Anyesh Nov 11, 2021
2e95ddb
revert(ml-waf): :rewind:
Anyesh Nov 16, 2021
21002bb
feat(v3): :sparkles: Change port for the `v3`
Anyesh Nov 16, 2021
4e25f48
test(v3): :sparkles: Add DEBUG env for background unittests
Anyesh Jan 15, 2022
e5835de
refactor(v3): :wastebasket: Depricate old modules
Anyesh Jan 15, 2022
62b0608
feat(v3): :white_check_mark: Add DEBUG flag to join worker thread
Anyesh Jan 15, 2022
e4a6af9
feat(v3): :sparkles: Add custom fields in message
Anyesh Jan 15, 2022
9a266c0
feat(v3): :bug: Add empty message(list) check
Anyesh Jan 15, 2022
8592f39
fix(background-submission): :bug: Add a simple break on queue emptyin…
Anyesh Jan 22, 2022
ded7a3b
build(v3): :bookmark: Update version to 3.0.0
Anyesh Feb 12, 2022
f7e1a1d
feat(v3): :construction: Get remote address from http headers
Anyesh Feb 12, 2022
7940da9
feat(v3): :sparkles: Add section for `remote_addr`
Anyesh Feb 12, 2022
60de876
feat(v3): :hammer: Add `remote_addr` for all framework
Anyesh Feb 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
USAGE_LOGGERS_DISABLE=False
USAGE_LOGGERS_URL="http://localhost:7701/message"
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
USAGE_LOGGERS_DISABLE=False
USAGE_LOGGERS_URL="http://localhost:4001/message"
USAGE_LOGGERS_URL="http://localhost:7701/message"
26 changes: 26 additions & 0 deletions .github/workflows/crossplatform_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Crossplatform Tests

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
27 changes: 0 additions & 27 deletions .github/workflows/pytest.yml

This file was deleted.

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ pip3 install --upgrade usagelogger

```python
from aiohttp import web
from usagelogger.aiohttp import HttpLoggerForAIOHTTP
from usagelogger.middleware.aiohttp import HttpLoggerForAIOHTTP

async def test(request):
return web.Response(text="Hello")

app = web.Application(
middlewares=[
HttpLoggerForAIOHTTP(
url="http://localhost:4001/message", rules="include debug"
url="http://localhost:7701/message", rules="include debug"
)
]
)
Expand All @@ -66,7 +66,7 @@ First edit `settings.py` to register middleware, like this:

```python
MIDDLEWARE = [
"usagelogger.django.HttpLoggerForDjango", # Always on the top
"usagelogger.middleware.django.HttpLoggerForDjango", # Always on the top
"django.middleware...",
]
```
Expand All @@ -75,7 +75,7 @@ Then add a new section to `settings.py` for logging configuration, like this:

```python
USAGELOGGER = {
'url': 'http://localhost:4001/message',
'url': 'http://localhost:7701/message',
'rules': 'include debug'
}
```
Expand All @@ -86,12 +86,12 @@ USAGELOGGER = {

```python
from flask import Flask
from usagelogger.flask import HttpLoggerForFlask
from usagelogger.middleware.flask import HttpLoggerForFlask

app = Flask(__name__)

app.wsgi_app = HttpLoggerForFlask( # type: ignore
app=app.wsgi_app, url="http://localhost:4001/message", rules="include debug"
app=app.wsgi_app, url="http://localhost:7701/message", rules="include debug"
)

@app.route("/")
Expand All @@ -108,7 +108,7 @@ app.run(debug=True)
```python
from usagelogger import resurface

s = resurface.Session(url="http://localhost:4001/message", rules="include debug")
s = resurface.Session(url="http://localhost:7701/message", rules="include debug")
s.get(...)
```

Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ exclude = '''
'''

[tool.pytest.ini_options]
testpaths = [
"tests",
]
log_cli = true
log_cli_level = "CRITICAL"
log_cli_format = "%(message)s"
Expand All @@ -25,3 +28,8 @@ log_file = "test_debug.log"
log_file_level = "DEBUG"
log_file_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_file_date_format = "%Y-%m-%d %H:%M:%S"

[build-system]
requires = ["setuptools>=42.0", "wheel"]
build-backend = "setuptools.build_meta"

1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ pytest==6.2.2
Werkzeug==1.0.1
django==3.1.12
aiohttp==3.7.4
tox==3.24.3
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

19 changes: 15 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
from setuptools import find_packages, setup
from distutils import util

from setuptools import setup


def read_file(name):
with open(name) as fd:
return fd.read()


middleware = util.convert_path("usagelogger/middleware")
utils = util.convert_path("usagelogger/utils")

setup(
name="usagelogger",
version="2.2.6",
version="3.0.0",
description="Logging usage of Python-based services, with user privacy by design.",
long_description=read_file("DESCRIPTIONS.md"),
long_description_content_type="text/markdown",
Expand All @@ -27,9 +32,15 @@ def read_file(name):
"Programming Language :: Python :: 3.9",
],
keywords="logging resurface",
packages=find_packages(exclude=["tests"]),
package_dir={
"usagelogger": "usagelogger",
"usagelogger.middleware": middleware,
"usagelogger.utils": utils,
},
packages=["usagelogger", "usagelogger.middleware", "usagelogger.utils"],
# packages=find_packages(exclude=["tests"]),
python_requires=">=3.7, <4",
install_requires=read_file("requirements.txt").splitlines(),
install_requires=["requests>=2"],
include_package_data=True,
tests_require=["pytest"],
project_urls={
Expand Down
5 changes: 5 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os
import sys

sys.path.append("/usagelogger")
os.environ.setdefault("DEBUG", "True")
29 changes: 29 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[tox]
minversion = 3.8.0
envlist = py37, py38, py39, flake8, mypy
isolated_build = true

[gh-actions]
python =
3.7: py37
3.8: py38, mypy, flake8
3.9: py39

[testenv]
setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements_dev.txt
commands =
pytest --basetemp={envtmpdir}

; [testenv:flake8]
; basepython = python3.8
; deps = flake8
; commands = flake8 usagelogger

; [testenv:mypy]
; basepython = python3.8
; deps =
; -r{toxinidir}/requirements_dev.txt
; commands = mypy usagelogger
7 changes: 7 additions & 0 deletions usagelogger/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import middleware # noqa
from .base_logger import BaseLogger # noqa
from .http_logger import HttpLogger # noqa
from .http_message import HttpMessage # noqa
Expand All @@ -16,4 +17,10 @@
"BaseLogger",
"HttpLogger",
"HttpMessage",
"resurface",
"middleware",
# Depricating soon
"flask",
"django",
"aiohttp",
]
Loading