Skip to content

Wrapped resource.serialize with json.dumps() to convert object to json#361

Merged
aaron-junot merged 1 commit intoOperationCode:mainfrom
evmende:json_log
Aug 13, 2020
Merged

Wrapped resource.serialize with json.dumps() to convert object to json#361
aaron-junot merged 1 commit intoOperationCode:mainfrom
evmende:json_log

Conversation

@evmende
Copy link
Copy Markdown
Collaborator

@evmende evmende commented Aug 13, 2020

Fixes #356

example PUT to api/v1/resources/1:

{
    "notes": "test2"
}

old logs:

2020-08-13 02:54:24,753 INFO User: ekmendes1@gmail.com Route: /api/v1/resources/1 Payload: {'notes': 'test2'}
2020-08-13 02:54:24,788 INFO Updating resource. Old data: {'id': 1, 'name': 'Free Programming Books', 'url': 'https://github.com/vhf/free-programming-books', 'category': 'Books', 'languages': ['multiple'], 'paid': False, 'notes': 'test1', 'upvotes': 0, 'downvotes': 0, 'times_clicked': 0, 'created_at': '2020-08-02 03:04:21', 'last_updated': '2020-08-13 02:49:18'}

new logs:

2020-08-13 02:49:18,768 INFO User: ekmendes1@gmail.com Route: /api/v1/resources/1 Payload: {'notes': 'test1'}
2020-08-13 02:49:18,816 INFO Updating resource. Old data: {"id": 1, "name": "Free Programming Books", "url": "https://github.com/vhf/free-programming-books", "category": "Books", "languages": ["multiple"], "paid": false, "notes": null, "upvotes": 0, "downvotes": 0, "times_clicked": 0, "created_at": "2020-08-02 03:04:21", "last_updated": ""}

Copy link
Copy Markdown
Member

@aaron-junot aaron-junot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aaron-junot aaron-junot merged commit c82df8d into OperationCode:main Aug 13, 2020
@evmende evmende deleted the json_log branch August 13, 2020 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When updating a resource, logs should print JSON

2 participants