-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[configurator] Expose log level env variable #3845
base: master
Are you sure you want to change the base?
Changes from all commits
a10add6
02e966d
22c7ecc
4380f78
a9698b6
adaf845
d4651f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Changelog | ||
|
||
## 5.8.1 | ||
|
||
- Expose configurable log level | ||
|
||
## 5.8.0 | ||
|
||
- Update base image to Alpine 3.19 | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||
--- | ||||||
version: 5.8.0 | ||||||
version: 5.8.1 | ||||||
slug: configurator | ||||||
name: File editor | ||||||
description: Simple browser-based file editor for Home Assistant | ||||||
|
@@ -33,6 +33,7 @@ options: | |||||
- .storage | ||||||
- deps | ||||||
ssh_keys: [] | ||||||
loglevel: info | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider changing default log level to 'warning' The PR's objective is to reduce "logspam" from HTTP request logging at 'info' level. However, keeping 'info' as the default maintains the same verbose logging behavior. Consider defaulting to 'warning' to address the stated problem while allowing users to opt-in to more verbose logging if needed. - loglevel: info
+ loglevel: warning 📝 Committable suggestion
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now the PR was only meant to allow the user to reduce logging verbosity and not change defaults. If maintainers agree I am very happy to set it to 'warning' instead, though. It is really unnecessary to log http requests by default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mueslo Exposing the log level configuration without changing the default maintains current behavior, allowing users to adjust logging verbosity as needed. |
||||||
panel_icon: mdi:wrench | ||||||
schema: | ||||||
dirsfirst: bool | ||||||
|
@@ -42,3 +43,4 @@ schema: | |||||
- str | ||||||
ssh_keys: | ||||||
- str | ||||||
loglevel: list(debug|info|warning|error|critical) |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,6 +7,7 @@ export HC_ENFORCE_BASEPATH | |||||||||||||||||||||
export HC_GIT | ||||||||||||||||||||||
export HC_HASS_API_PASSWORD | ||||||||||||||||||||||
export HC_IGNORE_PATTERN | ||||||||||||||||||||||
export HC_LOGLEVEL | ||||||||||||||||||||||
|
||||||||||||||||||||||
# If any SSH key files are defined in the configuration options, add them for use by git | ||||||||||||||||||||||
if bashio::config.has_value "ssh_keys"; then | ||||||||||||||||||||||
|
@@ -31,5 +32,7 @@ HC_ENFORCE_BASEPATH=$(bashio::config 'enforce_basepath') | |||||||||||||||||||||
HC_GIT=$(bashio::config 'git') | ||||||||||||||||||||||
HC_HASS_API_PASSWORD="${SUPERVISOR_TOKEN}" | ||||||||||||||||||||||
HC_IGNORE_PATTERN="$(bashio::config 'ignore_pattern | join(",")')" | ||||||||||||||||||||||
bashio::config.has_value 'loglevel' \ | ||||||||||||||||||||||
&& HC_LOGLEVEL="$(bashio::config 'loglevel')" || HC_LOGLEVEL=info | ||||||||||||||||||||||
Comment on lines
+35
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider improvements to the log level configuration
Consider this alternative implementation: -bashio::config.has_value 'loglevel' \
- && HC_LOGLEVEL="$(bashio::config 'loglevel')" || HC_LOGLEVEL=info
+# Validate log level
+LOGLEVEL="$(bashio::config.get 'loglevel' 'warning')"
+if [[ ! "${LOGLEVEL}" =~ ^(debug|info|warning|error|critical)$ ]]; then
+ bashio::log.error "Invalid log level: ${LOGLEVEL}"
+ bashio::log.error "Valid options are: debug, info, warning, error, critical"
+ bashio::exit.nok
+fi
+HC_LOGLEVEL="${LOGLEVEL}" 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
exec hass-configurator /etc/configurator.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance the loglevel option documentation
The documentation for the loglevel option needs more detail to help users make informed decisions.
Apply this diff to improve the documentation:
📝 Committable suggestion