diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 21:55:35 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 21:55:35 +0000 |
| commit | f016d6cdea9063bc60b0e7b53f93b121df95ad85 (patch) | |
| tree | 761fcf4b0ecea41e594972e7ae3f41871158a02d | |
| parent | ab0d932a618729fee6b3860c9a86a5c9f2eb3567 (diff) | |
automatic import of python-google-cloud-logger
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-google-cloud-logger.spec | 298 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 300 insertions, 0 deletions
@@ -0,0 +1 @@ +/google_cloud_logger-0.2.1.tar.gz diff --git a/python-google-cloud-logger.spec b/python-google-cloud-logger.spec new file mode 100644 index 0000000..8b7ce7c --- /dev/null +++ b/python-google-cloud-logger.spec @@ -0,0 +1,298 @@ +%global _empty_manifest_terminate_build 0 +Name: python-google-cloud-logger +Version: 0.2.1 +Release: 1 +Summary: Google Cloud Logger Formatter +License: MIT +URL: http://github.com/rai200890/python_google_cloud_logger +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/16/8a/7596ffed2de144c6d08b30d698a24db4f7c4378e0871b8c6805f9d1bea0c/google_cloud_logger-0.2.1.tar.gz +BuildArch: noarch + +Requires: python3-json-logger + +%description +# python_google_cloud_logger + +[](https://circleci.com/gh/rai200890/python_google_cloud_logger) +[](https://badge.fury.io/py/google-cloud-logger) +[](https://codeclimate.com/github/rai200890/python_google_cloud_logger/maintainability) +[](https://codeclimate.com/github/rai200890/python_google_cloud_logger/test_coverage) + +Python log formatter for Google Cloud according to [v2 specification](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) using [python-json-logger](https://github.com/madzak/python-json-logger) formatter + +Inspired by Elixir's [logger_json](https://github.com/Nebo15/logger_json) + +## Instalation + +### Pipenv + +``` + pipenv install google_cloud_logger +``` + +### Pip + +``` + pip install google_cloud_logger +``` + +## Usage + +```python +LOG_CONFIG = { + "version": 1, + "formatters": { + "json": { + "()": "google_cloud_logger.GoogleCloudFormatter", + "application_info": { + "type": "python-application", + "name": "Example Application" + }, + "format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s" + } + }, + "handlers": { + "json": { + "class": "logging.StreamHandler", + "formatter": "json" + } + }, + "loggers": { + "root": { + "level": "INFO", + "handlers": ["json"] + } + } +} +import logging + +from logging import config + +config.dictConfig(LOG_CONFIG) # load log config from dict + +logger = logging.getLogger("root") # get root logger instance + + +logger.info("farofa", extra={"extra": "extra"}) # log message with extra arguments +``` + +Example output: + +```json +{"timestamp": "2018-11-03T22:05:03.818000Z", "severity": "INFO", "message": "farofa", "labels": {"type": "python-application", "name": "Example Application"}, "metadata": {"userLabels": {"extra": "extra"}}, "sourceLocation": {"file": "<ipython-input-9-8e9384d78e2a>", "line": 1, "function": "<module>"}} +``` + +## Credits + +Thanks [@thulio](https://github.com/thulio), [@robsonpeixoto](https://github.com/robsonpeixoto), [@ramondelemos](https://github.com/ramondelemos) + + + +%package -n python3-google-cloud-logger +Summary: Google Cloud Logger Formatter +Provides: python-google-cloud-logger +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-google-cloud-logger +# python_google_cloud_logger + +[](https://circleci.com/gh/rai200890/python_google_cloud_logger) +[](https://badge.fury.io/py/google-cloud-logger) +[](https://codeclimate.com/github/rai200890/python_google_cloud_logger/maintainability) +[](https://codeclimate.com/github/rai200890/python_google_cloud_logger/test_coverage) + +Python log formatter for Google Cloud according to [v2 specification](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) using [python-json-logger](https://github.com/madzak/python-json-logger) formatter + +Inspired by Elixir's [logger_json](https://github.com/Nebo15/logger_json) + +## Instalation + +### Pipenv + +``` + pipenv install google_cloud_logger +``` + +### Pip + +``` + pip install google_cloud_logger +``` + +## Usage + +```python +LOG_CONFIG = { + "version": 1, + "formatters": { + "json": { + "()": "google_cloud_logger.GoogleCloudFormatter", + "application_info": { + "type": "python-application", + "name": "Example Application" + }, + "format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s" + } + }, + "handlers": { + "json": { + "class": "logging.StreamHandler", + "formatter": "json" + } + }, + "loggers": { + "root": { + "level": "INFO", + "handlers": ["json"] + } + } +} +import logging + +from logging import config + +config.dictConfig(LOG_CONFIG) # load log config from dict + +logger = logging.getLogger("root") # get root logger instance + + +logger.info("farofa", extra={"extra": "extra"}) # log message with extra arguments +``` + +Example output: + +```json +{"timestamp": "2018-11-03T22:05:03.818000Z", "severity": "INFO", "message": "farofa", "labels": {"type": "python-application", "name": "Example Application"}, "metadata": {"userLabels": {"extra": "extra"}}, "sourceLocation": {"file": "<ipython-input-9-8e9384d78e2a>", "line": 1, "function": "<module>"}} +``` + +## Credits + +Thanks [@thulio](https://github.com/thulio), [@robsonpeixoto](https://github.com/robsonpeixoto), [@ramondelemos](https://github.com/ramondelemos) + + + +%package help +Summary: Development documents and examples for google-cloud-logger +Provides: python3-google-cloud-logger-doc +%description help +# python_google_cloud_logger + +[](https://circleci.com/gh/rai200890/python_google_cloud_logger) +[](https://badge.fury.io/py/google-cloud-logger) +[](https://codeclimate.com/github/rai200890/python_google_cloud_logger/maintainability) +[](https://codeclimate.com/github/rai200890/python_google_cloud_logger/test_coverage) + +Python log formatter for Google Cloud according to [v2 specification](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) using [python-json-logger](https://github.com/madzak/python-json-logger) formatter + +Inspired by Elixir's [logger_json](https://github.com/Nebo15/logger_json) + +## Instalation + +### Pipenv + +``` + pipenv install google_cloud_logger +``` + +### Pip + +``` + pip install google_cloud_logger +``` + +## Usage + +```python +LOG_CONFIG = { + "version": 1, + "formatters": { + "json": { + "()": "google_cloud_logger.GoogleCloudFormatter", + "application_info": { + "type": "python-application", + "name": "Example Application" + }, + "format": "[%(asctime)s] %(levelname)s in %(module)s: %(message)s" + } + }, + "handlers": { + "json": { + "class": "logging.StreamHandler", + "formatter": "json" + } + }, + "loggers": { + "root": { + "level": "INFO", + "handlers": ["json"] + } + } +} +import logging + +from logging import config + +config.dictConfig(LOG_CONFIG) # load log config from dict + +logger = logging.getLogger("root") # get root logger instance + + +logger.info("farofa", extra={"extra": "extra"}) # log message with extra arguments +``` + +Example output: + +```json +{"timestamp": "2018-11-03T22:05:03.818000Z", "severity": "INFO", "message": "farofa", "labels": {"type": "python-application", "name": "Example Application"}, "metadata": {"userLabels": {"extra": "extra"}}, "sourceLocation": {"file": "<ipython-input-9-8e9384d78e2a>", "line": 1, "function": "<module>"}} +``` + +## Credits + +Thanks [@thulio](https://github.com/thulio), [@robsonpeixoto](https://github.com/robsonpeixoto), [@ramondelemos](https://github.com/ramondelemos) + + + +%prep +%autosetup -n google-cloud-logger-0.2.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-google-cloud-logger -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.1-1 +- Package Spec generated @@ -0,0 +1 @@ +aa7cb2189c463559635a7458756e27e3 google_cloud_logger-0.2.1.tar.gz |
