If DIFFUSERS_VERBOSITY env var is set to one of the valid choices return that as the new default level. If it is not - fall back to `_default_log_level`
()
| 50 | |
| 51 | |
| 52 | def _get_default_logging_level(): |
| 53 | """ |
| 54 | If DIFFUSERS_VERBOSITY env var is set to one of the valid choices return that as the new default level. If it is |
| 55 | not - fall back to `_default_log_level` |
| 56 | """ |
| 57 | env_level_str = os.getenv("DIFFUSERS_VERBOSITY", None) |
| 58 | if env_level_str: |
| 59 | if env_level_str in log_levels: |
| 60 | return log_levels[env_level_str] |
| 61 | else: |
| 62 | logging.getLogger().warning( |
| 63 | f"Unknown option DIFFUSERS_VERBOSITY={env_level_str}, " |
| 64 | f"has to be one of: { ', '.join(log_levels.keys()) }" |
| 65 | ) |
| 66 | return _default_log_level |
| 67 | |
| 68 | |
| 69 | def _get_library_name() -> str: |
no outgoing calls
no test coverage detected