From 0d952b79db0e7e8330418e9b0b638f9c7de73e31 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 10 Jul 2018 22:12:09 +0800 Subject: [PATCH] Improve logging in Python client (#480) * improve logging in python client * update samples --- bin/python-petstore-all.sh | 6 ++++++ .../src/main/resources/python/configuration.mustache | 11 ----------- .../python-asyncio/.openapi-generator/VERSION | 2 +- .../python-asyncio/petstore_api/configuration.py | 11 ----------- .../python-tornado/.openapi-generator/VERSION | 2 +- .../python-tornado/petstore_api/configuration.py | 11 ----------- .../client/petstore/python/.openapi-generator/VERSION | 2 +- .../petstore/python/petstore_api/configuration.py | 11 ----------- .../kotlin-server/ktor/.openapi-generator/VERSION | 2 +- samples/server/petstore/kotlin-server/ktor/README.md | 2 +- .../petstore/php-silex/.openapi-generator/VERSION | 2 +- 11 files changed, 12 insertions(+), 50 deletions(-) create mode 100755 bin/python-petstore-all.sh diff --git a/bin/python-petstore-all.sh b/bin/python-petstore-all.sh new file mode 100755 index 0000000000..1efab14e6e --- /dev/null +++ b/bin/python-petstore-all.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# update python petstore clients + +./bin/python-asyncio-petstore.sh +./bin/python-petstore.sh +./bin/python-tornado-petstore.sh diff --git a/modules/openapi-generator/src/main/resources/python/configuration.mustache b/modules/openapi-generator/src/main/resources/python/configuration.mustache index 398c1d3dab..8077c1ccf0 100644 --- a/modules/openapi-generator/src/main/resources/python/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/python/configuration.mustache @@ -125,17 +125,6 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): self.logger_file_handler.setFormatter(self.logger_formatter) for _, logger in six.iteritems(self.logger): logger.addHandler(self.logger_file_handler) - if self.logger_stream_handler: - logger.removeHandler(self.logger_stream_handler) - else: - # If not set logging file, - # then add stream handler and remove file handler. - self.logger_stream_handler = logging.StreamHandler() - self.logger_stream_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_stream_handler) - if self.logger_file_handler: - logger.removeHandler(self.logger_file_handler) @property def debug(self): diff --git a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION index a0cd9f0ccb..dde25ef08e 100644 --- a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION +++ b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.0 \ No newline at end of file +3.1.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-asyncio/petstore_api/configuration.py b/samples/client/petstore/python-asyncio/petstore_api/configuration.py index 67928abe37..c681604345 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/configuration.py +++ b/samples/client/petstore/python-asyncio/petstore_api/configuration.py @@ -133,17 +133,6 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): self.logger_file_handler.setFormatter(self.logger_formatter) for _, logger in six.iteritems(self.logger): logger.addHandler(self.logger_file_handler) - if self.logger_stream_handler: - logger.removeHandler(self.logger_stream_handler) - else: - # If not set logging file, - # then add stream handler and remove file handler. - self.logger_stream_handler = logging.StreamHandler() - self.logger_stream_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_stream_handler) - if self.logger_file_handler: - logger.removeHandler(self.logger_file_handler) @property def debug(self): diff --git a/samples/client/petstore/python-tornado/.openapi-generator/VERSION b/samples/client/petstore/python-tornado/.openapi-generator/VERSION index a0cd9f0ccb..dde25ef08e 100644 --- a/samples/client/petstore/python-tornado/.openapi-generator/VERSION +++ b/samples/client/petstore/python-tornado/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.0 \ No newline at end of file +3.1.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/petstore_api/configuration.py b/samples/client/petstore/python-tornado/petstore_api/configuration.py index 67928abe37..c681604345 100644 --- a/samples/client/petstore/python-tornado/petstore_api/configuration.py +++ b/samples/client/petstore/python-tornado/petstore_api/configuration.py @@ -133,17 +133,6 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): self.logger_file_handler.setFormatter(self.logger_formatter) for _, logger in six.iteritems(self.logger): logger.addHandler(self.logger_file_handler) - if self.logger_stream_handler: - logger.removeHandler(self.logger_stream_handler) - else: - # If not set logging file, - # then add stream handler and remove file handler. - self.logger_stream_handler = logging.StreamHandler() - self.logger_stream_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_stream_handler) - if self.logger_file_handler: - logger.removeHandler(self.logger_file_handler) @property def debug(self): diff --git a/samples/client/petstore/python/.openapi-generator/VERSION b/samples/client/petstore/python/.openapi-generator/VERSION index a0cd9f0ccb..dde25ef08e 100644 --- a/samples/client/petstore/python/.openapi-generator/VERSION +++ b/samples/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.0 \ No newline at end of file +3.1.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index 67928abe37..c681604345 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -133,17 +133,6 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): self.logger_file_handler.setFormatter(self.logger_formatter) for _, logger in six.iteritems(self.logger): logger.addHandler(self.logger_file_handler) - if self.logger_stream_handler: - logger.removeHandler(self.logger_stream_handler) - else: - # If not set logging file, - # then add stream handler and remove file handler. - self.logger_stream_handler = logging.StreamHandler() - self.logger_stream_handler.setFormatter(self.logger_formatter) - for _, logger in six.iteritems(self.logger): - logger.addHandler(self.logger_stream_handler) - if self.logger_file_handler: - logger.removeHandler(self.logger_file_handler) @property def debug(self): diff --git a/samples/server/petstore/kotlin-server/ktor/.openapi-generator/VERSION b/samples/server/petstore/kotlin-server/ktor/.openapi-generator/VERSION index 0628777500..dde25ef08e 100644 --- a/samples/server/petstore/kotlin-server/ktor/.openapi-generator/VERSION +++ b/samples/server/petstore/kotlin-server/ktor/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.0-SNAPSHOT \ No newline at end of file +3.1.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin-server/ktor/README.md b/samples/server/petstore/kotlin-server/ktor/README.md index 82c3596aa3..99dcb190b9 100644 --- a/samples/server/petstore/kotlin-server/ktor/README.md +++ b/samples/server/petstore/kotlin-server/ktor/README.md @@ -2,7 +2,7 @@ This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -Generated by OpenAPI Generator 3.1.0-SNAPSHOT. +Generated by OpenAPI Generator 3.1.1-SNAPSHOT. ## Requires diff --git a/samples/server/petstore/php-silex/.openapi-generator/VERSION b/samples/server/petstore/php-silex/.openapi-generator/VERSION index 1c00c51815..dde25ef08e 100644 --- a/samples/server/petstore/php-silex/.openapi-generator/VERSION +++ b/samples/server/petstore/php-silex/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.2-SNAPSHOT \ No newline at end of file +3.1.1-SNAPSHOT \ No newline at end of file