FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

adding logging by akefeli · Pull Request #12 · google/python-spanner-orm · GitHub

adding logging - #12

Merged
akefeli merged 4 commits into
masterfrom
akefeli_logging
Nov 9, 2018
Merged

akefeli merged 4 commits into
masterfrom
akefeli_logging

Conversation

akefeli commented Nov 9, 2018
edited
Loading

Copy link
Copy Markdown
Contributor

this setup seems to be best practices for a library. there are probably other places we can add loggin, I only added to api for now.
If a client wants to see these logs, they need to:
logging.getLogger('spanner_orm').setLevel(logging.DEBUG)

Comment thread spanner_orm/api.py
@staticmethod
def find(transaction, table_name, columns, keyset):
"""Obtains rows with primary_keys from the given table."""
_logger.debug('Find table=%s columns=%s keys=%s',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

the string interpolation format currently being used in this project is:

'{value}'.format(value=<value>)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

logging methods are exception to that to avoid constructing the string if it is not going to be printed(level criteria not met, etc)

Comment thread spanner_orm/api.py Outdated
@staticmethod
def sql_query(transaction, query, parameters, parameter_types):
"""Runs a read only SQL query."""
_logger.debug('%s\n%s\n%s', query, parameters, parameter_types)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this should indicate that the log is from executing a sql query

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

done

dcbrandao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

ok, makes sense

akefeli merged commit 10fd35d into master Nov 9, 2018
akefeli deleted the akefeli_logging branch November 9, 2018 19:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL