From 240b64f21c03627e41025b2c39e36710e8847d31 Mon Sep 17 00:00:00 2001 From: "Jeffrey S. Ruby" Date: Wed, 27 Mar 2024 20:36:44 -0500 Subject: [PATCH 1/5] Stop wsgiref.simple_server from logging to stderr by default. --- awnet/rootfs/awnet.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awnet/rootfs/awnet.py b/awnet/rootfs/awnet.py index b6ef5cb..144f225 100644 --- a/awnet/rootfs/awnet.py +++ b/awnet/rootfs/awnet.py @@ -141,6 +141,9 @@ def parse_request(self): self.raw_requestline = new_raw_requestline _LOGGER.debug("new raw_requestline: %s", self.raw_requestline) return super().parse_request() + # override defalt server logging + def log_message(self, format, *args): + pass if __name__ == "__main__": from wsgiref.simple_server import make_server From 70d2ce94c97383b02a7a8e5310cd465a1fa56bfe Mon Sep 17 00:00:00 2001 From: Thomas Skinner Date: Sat, 30 Mar 2024 13:32:28 +0000 Subject: [PATCH 2/5] change to python logger, update changelog --- awnet/CHANGELOG.md | 7 +++++++ awnet/config.yaml | 2 +- awnet/rootfs/awnet.py | 7 ++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/awnet/CHANGELOG.md b/awnet/CHANGELOG.md index 4b9a595..3699d4e 100644 --- a/awnet/CHANGELOG.md +++ b/awnet/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## [1.1.1] - 2024-03-30 + +### Changed + +- Update logging format to include file name and line number for easier troubleshooting; update format for readability. +- Update logger for WSGI to use the built-in Python logger. + ## [1.1.0] - 2024-01-27 ### Changed diff --git a/awnet/config.yaml b/awnet/config.yaml index 51115b5..c4f3a09 100644 --- a/awnet/config.yaml +++ b/awnet/config.yaml @@ -1,5 +1,5 @@ name: AWNET to HASS -version: 1.1.0 +version: 1.1.1 slug: awnet_to_hass description: Addon to capture local Ambient Weather data in Home Assistant arch: diff --git a/awnet/rootfs/awnet.py b/awnet/rootfs/awnet.py index 144f225..0da9a49 100644 --- a/awnet/rootfs/awnet.py +++ b/awnet/rootfs/awnet.py @@ -141,15 +141,16 @@ def parse_request(self): self.raw_requestline = new_raw_requestline _LOGGER.debug("new raw_requestline: %s", self.raw_requestline) return super().parse_request() - # override defalt server logging + + # Use the built-in log handler rather than outputting to stderr def log_message(self, format, *args): - pass + _LOGGER.info(format, *args) if __name__ == "__main__": from wsgiref.simple_server import make_server logging.basicConfig(stream = sys.stdout, - format = '%(asctime)s %(levelname)8s : %(message)s', + format = '[%(asctime)s] [%(levelname)-8s] %(message)s (%(filename)s:%(lineno)d)', level = sys.argv[1]) # probably shouldn't run on port 80 but that's what I specified in the ambient weather console From c8c63faa959037421ade6f3f6b963622fd886eaf Mon Sep 17 00:00:00 2001 From: Thomas Skinner Date: Sat, 30 Mar 2024 13:36:29 +0000 Subject: [PATCH 3/5] builder update --- .github/workflows/builder-publish.yaml | 2 +- .github/workflows/builder.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/builder-publish.yaml b/.github/workflows/builder-publish.yaml index 0731c00..5c52525 100644 --- a/.github/workflows/builder-publish.yaml +++ b/.github/workflows/builder-publish.yaml @@ -97,7 +97,7 @@ jobs: - name: Build ${{ matrix.addon }} add-on if: steps.check.outputs.build_arch == 'true' - uses: home-assistant/builder@2024.01.0 + uses: home-assistant/builder@2024.03.5 with: args: | ${{ env.BUILD_ARGS }} \ diff --git a/.github/workflows/builder.yaml b/.github/workflows/builder.yaml index 3b13305..a99e3d0 100644 --- a/.github/workflows/builder.yaml +++ b/.github/workflows/builder.yaml @@ -97,7 +97,7 @@ jobs: - name: Build ${{ matrix.addon }} add-on if: steps.check.outputs.build_arch == 'true' - uses: home-assistant/builder@2024.01.0 + uses: home-assistant/builder@2024.03.5 with: args: | ${{ env.BUILD_ARGS }} \ From 13ece9268f92e1aac06c12569250bc01cbeeb3e7 Mon Sep 17 00:00:00 2001 From: Thomas Skinner Date: Sat, 30 Mar 2024 13:38:27 +0000 Subject: [PATCH 4/5] cl attribution --- awnet/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awnet/CHANGELOG.md b/awnet/CHANGELOG.md index 3699d4e..098f486 100644 --- a/awnet/CHANGELOG.md +++ b/awnet/CHANGELOG.md @@ -7,7 +7,7 @@ All notable changes to this project will be documented in this file. ### Changed - Update logging format to include file name and line number for easier troubleshooting; update format for readability. -- Update logger for WSGI to use the built-in Python logger. +- Update logger for WSGI to use the built-in Python logger (and not log out to stderr, thanks @jruby411!). ## [1.1.0] - 2024-01-27 From 7139fb7f498683f2dfcff30aaa033fb01052a675 Mon Sep 17 00:00:00 2001 From: Thomas Skinner Date: Sat, 30 Mar 2024 13:41:52 +0000 Subject: [PATCH 5/5] lint with latest --- .github/workflows/lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b94b631..3abc96a 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -31,6 +31,6 @@ jobs: uses: actions/checkout@v3.3.0 - name: 🚀 Run Home Assistant Add-on Lint - uses: frenck/action-addon-linter@v2.11 + uses: frenck/action-addon-linter@main with: path: "./${{ matrix.path }}"