-
Notifications
You must be signed in to change notification settings - Fork 0
Add working example of environment based time zones #73
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
90aad61
Add working example of environment based time zones
emmuhamm 5410618
add better safe loader
emmuhamm f576dd8
ruff
emmuhamm eba6f20
Offload themes to separate theme files
emmuhamm 461fed7
Add basic logic on choosing themes
emmuhamm 7485f58
Improve logic handling of env variables
emmuhamm d70df91
add dark and light themes
emmuhamm abb4746
Add a check against unknown theme files
emmuhamm 5210cad
modify theme details for clarity
emmuhamm 9861dac
Add docs
emmuhamm 1767250
ruff
emmuhamm a4d844e
add better packaging
emmuhamm 62fe047
add bashrc thing
emmuhamm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Environment configurations | ||
|
|
||
| `daqpytools` has the power for you to configure your current instance of the loggings! This allows each user to change the timezone and the color themes to suit them as the logs come out. | ||
|
|
||
| The way this is configured is by setting environment variables. By default, these are _unset_ in the terminal, which daqpytools will read and resolve to a default value. These default values can be found in `logging/log_format.ini`. | ||
|
|
||
| If a non-default time zone/theme is preferred, it is recommended to set the env vars `DUNEDAQ_TIMEZONE` and `DUNEDAQ_LOGGING_THEME` in your `~/.bashrc`. | ||
|
|
||
| ## Timezones | ||
|
|
||
| To change the timezone, simply do | ||
|
|
||
| `export DUNEDAQ_TIMEZONE="[timezone]"` | ||
|
|
||
| eg. `export DUNEDAQ_TIMEZONE="UTC"` | ||
|
|
||
| Valid values are those that are listed in `pytz.all_timezones`. | ||
|
|
||
| An example with `Europe/London`. | ||
|
|
||
|  | ||
|
|
||
|
|
||
| ## Logging themes | ||
|
|
||
| The themes are defined in daqpytools, in `logging/themes`, where you can see all the different themes available. To change between them, simply do | ||
|
|
||
| `export DUNEDAQ_LOGGING_THEME="[themename]"` | ||
|
|
||
| eg. `export DUNEDAQ_LOGGING_THEME="dark"` | ||
|
|
||
| There are checks in place to ensure that the theme choice is valid before logs are printed. | ||
|
|
||
| An example with `black`. | ||
|  | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| [theme] | ||
| # Define the color theme for logging output | ||
| # Colors can be set to 'dim', 'bold', or 'bright' variants of the colors | ||
| # Available colors: black, red, green, yellow, blue, magenta, cyan | ||
| # Background colors can be set with 'on_' prefix | ||
|
|
||
| # === Context elements === | ||
| # Available colors: black, red, green, yellow, blue, magenta, cyan, white | ||
| # You can also use: bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white | ||
| # Styles: dim, bold, italic, underline, reverse, blink, conceal, strike | ||
| # Combine styles and colors, e.g., "bold magenta", "dim cyan", "bold white on red" | ||
| # Rich color reference: https://rich.readthedocs.io/en/stable/appendix/colors.html | ||
| # Rich style reference: https://rich.readthedocs.io/en/latest/style.html | ||
|
|
||
| # Theme specific details | ||
| # This one makes everything black, which is a nice colorless default for people to use | ||
|
|
||
| logging.time = black | ||
| logging.location = black | ||
| logging.logger_name = black | ||
|
|
||
| # === Log level colors === | ||
| logging.level.debug = black | ||
| logging.level.info = black | ||
| logging.level.warning = black | ||
| logging.level.error = black | ||
| logging.level.critical = black |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| [theme] | ||
| # Define the color theme for logging output | ||
| # Colors can be set to 'dim', 'bold', or 'bright' variants of the colors | ||
| # Available colors: black, red, green, yellow, blue, magenta, cyan | ||
| # Background colors can be set with 'on_' prefix | ||
|
|
||
| # === Context elements === | ||
| # Available colors: black, red, green, yellow, blue, magenta, cyan, white | ||
| # You can also use: bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white | ||
| # Styles: dim, bold, italic, underline, reverse, blink, conceal, strike | ||
| # Combine styles and colors, e.g., "bold magenta", "dim cyan", "bold white on red" | ||
| # Rich color reference: https://rich.readthedocs.io/en/stable/appendix/colors.html | ||
| # Rich style reference: https://rich.readthedocs.io/en/latest/style.html | ||
|
|
||
| # Theme specific details | ||
| # Safe to use on all dark (including black) themes. The colors should still be legible. | ||
|
|
||
| logging.time = blue | ||
| logging.location = grey74 | ||
| logging.logger_name = grey74 | ||
|
|
||
| # === Log level colors === | ||
| logging.level.debug = cyan | ||
| logging.level.info = bold green | ||
| logging.level.warning = bold yellow | ||
| logging.level.error = bold red | ||
| logging.level.critical = bold white on red |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| [theme] | ||
| # Define the color theme for logging output | ||
| # Colors can be set to 'dim', 'bold', or 'bright' variants of the colors | ||
| # Available colors: black, red, green, yellow, blue, magenta, cyan | ||
| # Background colors can be set with 'on_' prefix | ||
|
|
||
| # === Context elements === | ||
| # Available colors: black, red, green, yellow, blue, magenta, cyan, white | ||
| # You can also use: bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white | ||
| # Styles: dim, bold, italic, underline, reverse, blink, conceal, strike | ||
| # Combine styles and colors, e.g., "bold magenta", "dim cyan", "bold white on red" | ||
| # Rich color reference: https://rich.readthedocs.io/en/stable/appendix/colors.html | ||
| # Rich style reference: https://rich.readthedocs.io/en/latest/style.html | ||
|
|
||
| # Theme specific details | ||
| # Safe to use on all light (including white) themes. The colors should still be legible. | ||
|
|
||
| logging.time = dim blue | ||
| logging.location = dim white | ||
| logging.logger_name = dim white | ||
|
|
||
| # === Log level colors === | ||
| logging.level.debug = dim cyan | ||
| logging.level.info = bold green | ||
| logging.level.warning = bold yellow | ||
| logging.level.error = bold red | ||
| logging.level.critical = bold white on red |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| [theme] | ||
| # Define the color theme for logging output | ||
| # Colors can be set to 'dim', 'bold', or 'bright' variants of the colors | ||
| # Available colors: black, red, green, yellow, blue, magenta, cyan | ||
| # Background colors can be set with 'on_' prefix | ||
|
|
||
| # === Context elements === | ||
| # Available colors: black, red, green, yellow, blue, magenta, cyan, white | ||
| # You can also use: bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white | ||
| # Styles: dim, bold, italic, underline, reverse, blink, conceal, strike | ||
| # Combine styles and colors, e.g., "bold magenta", "dim cyan", "bold white on red" | ||
| # Rich color reference: https://rich.readthedocs.io/en/stable/appendix/colors.html | ||
| # Rich style reference: https://rich.readthedocs.io/en/latest/style.html | ||
|
|
||
| # Theme specific details | ||
| # This one makes everything black, which is a nice colorless default for people to use | ||
|
|
||
| logging.time = blue | ||
| logging.location = bright_black | ||
| logging.logger_name = bright_black | ||
|
|
||
| # === Log level colors === | ||
| logging.level.debug = cyan | ||
| logging.level.info = bold green | ||
| logging.level.warning = bold yellow | ||
| logging.level.error = bold red | ||
| logging.level.critical = bold white on red |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.