use 'AYON_LOG_NO_COLORS' and 'AYON_DEBUG'

This commit is contained in:
Jakub Trllo 2024-02-07 16:24:49 +01:00
parent 5a21d04315
commit e8954219ae
25 changed files with 32 additions and 32 deletions

View file

@ -11,7 +11,7 @@ class AfterEffectsAddon(OpenPypeModule, IHostAddon):
def add_implementation_envs(self, env, _app): def add_implementation_envs(self, env, _app):
"""Modify environments to contain all required for implementation.""" """Modify environments to contain all required for implementation."""
defaults = { defaults = {
"OPENPYPE_LOG_NO_COLORS": "True", "AYON_LOG_NO_COLORS": "1",
"WEBSOCKET_URL": "ws://localhost:8097/ws/" "WEBSOCKET_URL": "ws://localhost:8097/ws/"
} }
for key, value in defaults.items(): for key, value in defaults.items():

View file

@ -17,7 +17,7 @@ async function startUp(url){
var res = await promis; var res = await promis;
log.warn("res: " + res); log.warn("res: " + res);
promis = runEvalScript("getEnv('OPENPYPE_DEBUG')"); promis = runEvalScript("getEnv('AYON_DEBUG')");
var debug = await promis; var debug = await promis;
log.warn("debug: " + debug); log.warn("debug: " + debug);
if (debug && debug.toString() == '3'){ if (debug && debug.toString() == '3'){

View file

@ -42,7 +42,7 @@ def main(*subprocess_args):
host = AfterEffectsHost() host = AfterEffectsHost()
install_host(host) install_host(host)
os.environ["OPENPYPE_LOG_NO_COLORS"] = "False" os.environ["AYON_LOG_NO_COLORS"] = "0"
app = get_ayon_qt_app() app = get_ayon_qt_app()
app.setQuitOnLastWindowClosed(False) app.setQuitOnLastWindowClosed(False)

View file

@ -63,7 +63,7 @@ class FusionAddon(OpenPypeModule, IHostAddon):
def add_implementation_envs(self, env, app): def add_implementation_envs(self, env, app):
# Set default values if are not already set via settings # Set default values if are not already set via settings
defaults = {"OPENPYPE_LOG_NO_COLORS": "Yes"} defaults = {"AYON_LOG_NO_COLORS": "1"}
for key, value in defaults.items(): for key, value in defaults.items():
if not env.get(key): if not env.get(key):
env[key] = value env[key] = value

View file

@ -81,7 +81,7 @@ class _ZipFile(zipfile.ZipFile):
def main(*subprocess_args): def main(*subprocess_args):
# coloring in StdOutBroker # coloring in StdOutBroker
os.environ["OPENPYPE_LOG_NO_COLORS"] = "False" os.environ["AYON_LOG_NO_COLORS"] = "0"
app = QtWidgets.QApplication([]) app = QtWidgets.QApplication([])
app.setQuitOnLastWindowClosed(False) app.setQuitOnLastWindowClosed(False)
icon = QtGui.QIcon(style.get_app_icon_path()) icon = QtGui.QIcon(style.get_app_icon_path())

View file

@ -29,7 +29,7 @@ class MayaAddon(OpenPypeModule, IHostAddon):
# Set default environments # Set default environments
envs = { envs = {
"OPENPYPE_LOG_NO_COLORS": "Yes", "AYON_LOG_NO_COLORS": "1",
# For python module 'qtpy' # For python module 'qtpy'
"QT_API": "PySide2", "QT_API": "PySide2",
# For python module 'Qt' # For python module 'Qt'

View file

@ -14,7 +14,7 @@ class PhotoshopAddon(OpenPypeModule, IHostAddon):
def add_implementation_envs(self, env, _app): def add_implementation_envs(self, env, _app):
"""Modify environments to contain all required for implementation.""" """Modify environments to contain all required for implementation."""
defaults = { defaults = {
"OPENPYPE_LOG_NO_COLORS": "True", "AYON_LOG_NO_COLORS": "1",
"WEBSOCKET_URL": "ws://localhost:8099/ws/" "WEBSOCKET_URL": "ws://localhost:8099/ws/"
} }
for key, value in defaults.items(): for key, value in defaults.items():

View file

@ -28,7 +28,7 @@ def main(*subprocess_args):
sys.excepthook = safe_excepthook sys.excepthook = safe_excepthook
# coloring in StdOutBroker # coloring in StdOutBroker
os.environ["OPENPYPE_LOG_NO_COLORS"] = "False" os.environ["AYON_LOG_NO_COLORS"] = "0"
app = get_ayon_qt_app() app = get_ayon_qt_app()
app.setQuitOnLastWindowClosed(False) app.setQuitOnLastWindowClosed(False)

View file

@ -25,7 +25,7 @@ class PreLaunchResolveSetup(PreLaunchHook):
It also defines: It also defines:
- `RESOLVE_UTILITY_SCRIPTS_DIR`: Destination directory for OpenPype - `RESOLVE_UTILITY_SCRIPTS_DIR`: Destination directory for OpenPype
Fusion scripts to be copied to for Resolve to pick them up. Fusion scripts to be copied to for Resolve to pick them up.
- `OPENPYPE_LOG_NO_COLORS` to True to ensure OP doesn't try to - `AYON_LOG_NO_COLORS` to True to ensure OP doesn't try to
use logging with terminal colors as it fails in Resolve. use logging with terminal colors as it fails in Resolve.
""" """
@ -132,7 +132,7 @@ class PreLaunchResolveSetup(PreLaunchHook):
] = resolve_utility_scripts_dir.as_posix() ] = resolve_utility_scripts_dir.as_posix()
# remove terminal coloring tags # remove terminal coloring tags
self.launch_context.env["OPENPYPE_LOG_NO_COLORS"] = "True" self.launch_context.env["AYON_LOG_NO_COLORS"] = "1"
# Resolve Setup integration # Resolve Setup integration
setup(self.launch_context.env) setup(self.launch_context.env)

View file

@ -21,7 +21,7 @@ class SubstanceAddon(OpenPypeModule, IHostAddon):
env["SUBSTANCE_PAINTER_PLUGINS_PATH"] = plugin_path env["SUBSTANCE_PAINTER_PLUGINS_PATH"] = plugin_path
# Log in Substance Painter doesn't support custom terminal colors # Log in Substance Painter doesn't support custom terminal colors
env["OPENPYPE_LOG_NO_COLORS"] = "Yes" env["AYON_LOG_NO_COLORS"] = "1"
def get_launch_hook_paths(self, app): def get_launch_hook_paths(self, app):
if app.host_name != self.host_name: if app.host_name != self.host_name:

View file

@ -23,7 +23,7 @@ class TVPaintAddon(OpenPypeModule, IHostAddon):
"""Modify environments to contain all required for implementation.""" """Modify environments to contain all required for implementation."""
defaults = { defaults = {
"OPENPYPE_LOG_NO_COLORS": "True" "AYON_LOG_NO_COLORS": "1"
} }
for key, value in defaults.items(): for key, value in defaults.items():
if not env.get(key): if not env.get(key):

View file

@ -59,7 +59,7 @@ class UnrealAddon(OpenPypeModule, IHostAddon):
# Set default environments if are not set via settings # Set default environments if are not set via settings
defaults = { defaults = {
"OPENPYPE_LOG_NO_COLORS": "True", "AYON_LOG_NO_COLORS": "1",
"UE_PYTHONPATH": os.environ.get("PYTHONPATH", ""), "UE_PYTHONPATH": os.environ.get("PYTHONPATH", ""),
} }
for key, value in defaults.items(): for key, value in defaults.items():

View file

@ -134,7 +134,7 @@ class Logger:
initialized = False initialized = False
_init_lock = threading.Lock() _init_lock = threading.Lock()
# Logging level - OPENPYPE_LOG_LEVEL # Logging level - AYON_LOG_LEVEL
log_level = None log_level = None
# Data same for all record documents # Data same for all record documents
@ -194,10 +194,10 @@ class Logger:
cls.initialized = False cls.initialized = False
# Define what is logging level # Define what is logging level
log_level = os.getenv("OPENPYPE_LOG_LEVEL") log_level = os.getenv("AYON_LOG_LEVEL")
if not log_level: if not log_level:
# Check OPENPYPE_DEBUG for backwards compatibility # Check AYON_DEBUG for debug level
op_debug = os.getenv("OPENPYPE_DEBUG") op_debug = os.getenv("AYON_DEBUG")
if op_debug and int(op_debug) > 0: if op_debug and int(op_debug) > 0:
log_level = 10 log_level = 10
else: else:

View file

@ -21,7 +21,7 @@ class Terminal:
If :mod:`Colorama` is not found, it will still work, but without colors. If :mod:`Colorama` is not found, it will still work, but without colors.
Depends on :mod:`Colorama` Depends on :mod:`Colorama`
Using **OPENPYPE_LOG_NO_COLORS** environment variable. Using **AYON_LOG_NO_COLORS** environment variable.
""" """
# Is Terminal initialized # Is Terminal initialized
@ -38,7 +38,7 @@ class Terminal:
"""Initialize Terminal class as object. """Initialize Terminal class as object.
First check if colorized output is disabled by environment variable First check if colorized output is disabled by environment variable
`OPENPYPE_LOG_NO_COLORS` value. By default is colorized output turned `AYON_LOG_NO_COLORS` value. By default is colorized output turned
on. on.
Then tries to import python module that do the colors magic and create Then tries to import python module that do the colors magic and create
@ -50,7 +50,7 @@ class Terminal:
from ayon_core.lib import env_value_to_bool from ayon_core.lib import env_value_to_bool
log_no_colors = env_value_to_bool( log_no_colors = env_value_to_bool(
"OPENPYPE_LOG_NO_COLORS", default=None "AYON_LOG_NO_COLORS", default=None
) )
if log_no_colors is not None: if log_no_colors is not None:
Terminal.use_colors = not log_no_colors Terminal.use_colors = not log_no_colors
@ -169,7 +169,7 @@ class Terminal:
def log(message): def log(message):
"""Return color formatted message. """Return color formatted message.
If environment variable `OPENPYPE_LOG_NO_COLORS` is set to If environment variable `AYON_LOG_NO_COLORS` is set to
whatever value, message will be formatted but not colorized. whatever value, message will be formatted but not colorized.
Args: Args:

View file

@ -86,7 +86,7 @@ class AfterEffectsSubmitDeadline(
"AVALON_TASK", "AVALON_TASK",
"AVALON_APP_NAME", "AVALON_APP_NAME",
"OPENPYPE_DEV", "OPENPYPE_DEV",
"OPENPYPE_LOG_NO_COLORS", "AYON_LOG_NO_COLORS",
"IS_TEST" "IS_TEST"
] ]

View file

@ -122,7 +122,7 @@ class BlenderSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
# to recognize job from PYPE for turning Event On/Off # to recognize job from PYPE for turning Event On/Off
job_info.add_render_job_env_var() job_info.add_render_job_env_var()
job_info.EnvironmentKeyValue["OPENPYPE_LOG_NO_COLORS"] = "1" job_info.EnvironmentKeyValue["AYON_LOG_NO_COLORS"] = "1"
# Adding file dependencies. # Adding file dependencies.
if self.asset_dependencies: if self.asset_dependencies:

View file

@ -226,7 +226,7 @@ class FusionSubmitDeadline(
"AVALON_TASK", "AVALON_TASK",
"AVALON_APP_NAME", "AVALON_APP_NAME",
"OPENPYPE_DEV", "OPENPYPE_DEV",
"OPENPYPE_LOG_NO_COLORS", "AYON_LOG_NO_COLORS",
"IS_TEST", "IS_TEST",
"AYON_BUNDLE_NAME", "AYON_BUNDLE_NAME",
] ]

View file

@ -279,7 +279,7 @@ class HarmonySubmitDeadline(
"AVALON_TASK", "AVALON_TASK",
"AVALON_APP_NAME", "AVALON_APP_NAME",
"OPENPYPE_DEV", "OPENPYPE_DEV",
"OPENPYPE_LOG_NO_COLORS" "AYON_LOG_NO_COLORS"
"IS_TEST" "IS_TEST"
] ]

View file

@ -104,7 +104,7 @@ class HoudiniCacheSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline
"AVALON_TASK", "AVALON_TASK",
"AVALON_APP_NAME", "AVALON_APP_NAME",
"OPENPYPE_DEV", "OPENPYPE_DEV",
"OPENPYPE_LOG_NO_COLORS", "AYON_LOG_NO_COLORS",
] ]
environment = dict({key: os.environ[key] for key in keys environment = dict({key: os.environ[key] for key in keys

View file

@ -209,7 +209,7 @@ class HoudiniSubmitDeadline(
"AVALON_TASK", "AVALON_TASK",
"AVALON_APP_NAME", "AVALON_APP_NAME",
"OPENPYPE_DEV", "OPENPYPE_DEV",
"OPENPYPE_LOG_NO_COLORS", "AYON_LOG_NO_COLORS",
] ]
environment = dict({key: os.environ[key] for key in keys environment = dict({key: os.environ[key] for key in keys

View file

@ -126,7 +126,7 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
# to recognize render jobs # to recognize render jobs
job_info.add_render_job_env_var() job_info.add_render_job_env_var()
job_info.EnvironmentKeyValue["OPENPYPE_LOG_NO_COLORS"] = "1" job_info.EnvironmentKeyValue["AYON_LOG_NO_COLORS"] = "1"
# Add list of expected files to job # Add list of expected files to job
# --------------------------------- # ---------------------------------

View file

@ -219,7 +219,7 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
# to recognize render jobs # to recognize render jobs
job_info.add_render_job_env_var() job_info.add_render_job_env_var()
job_info.EnvironmentKeyValue["OPENPYPE_LOG_NO_COLORS"] = "1" job_info.EnvironmentKeyValue["AYON_LOG_NO_COLORS"] = "1"
# Adding file dependencies. # Adding file dependencies.
if not bool(os.environ.get("IS_TEST")) and self.asset_dependencies: if not bool(os.environ.get("IS_TEST")) and self.asset_dependencies:

View file

@ -106,10 +106,10 @@ class MayaSubmitRemotePublishDeadline(
environment["AVALON_ASSET"] = instance.context.data["asset"] environment["AVALON_ASSET"] = instance.context.data["asset"]
environment["AVALON_TASK"] = instance.context.data["task"] environment["AVALON_TASK"] = instance.context.data["task"]
environment["AVALON_APP_NAME"] = os.environ.get("AVALON_APP_NAME") environment["AVALON_APP_NAME"] = os.environ.get("AVALON_APP_NAME")
environment["OPENPYPE_LOG_NO_COLORS"] = "1"
environment["OPENPYPE_USERNAME"] = instance.context.data["user"] environment["OPENPYPE_USERNAME"] = instance.context.data["user"]
environment["OPENPYPE_PUBLISH_SUBSET"] = instance.data["subset"] environment["OPENPYPE_PUBLISH_SUBSET"] = instance.data["subset"]
environment["OPENPYPE_REMOTE_PUBLISH"] = "1" environment["OPENPYPE_REMOTE_PUBLISH"] = "1"
environment["AYON_LOG_NO_COLORS"] = "1"
environment["AYON_REMOTE_PUBLISH"] = "1" environment["AYON_REMOTE_PUBLISH"] = "1"
for key, value in environment.items(): for key, value in environment.items():

View file

@ -134,7 +134,7 @@ class ProcessSubmittedCacheJobOnFarm(pyblish.api.InstancePlugin,
"AVALON_ASSET": instance.context.data["asset"], "AVALON_ASSET": instance.context.data["asset"],
"AVALON_TASK": instance.context.data["task"], "AVALON_TASK": instance.context.data["task"],
"OPENPYPE_USERNAME": instance.context.data["user"], "OPENPYPE_USERNAME": instance.context.data["user"],
"OPENPYPE_LOG_NO_COLORS": "1", "AYON_LOG_NO_COLORS": "1",
"IS_TEST": str(int(is_in_tests())), "IS_TEST": str(int(is_in_tests())),
"AYON_PUBLISH_JOB": "1", "AYON_PUBLISH_JOB": "1",
"AYON_RENDER_JOB": "0", "AYON_RENDER_JOB": "0",

View file

@ -190,7 +190,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
"AVALON_ASSET": instance.context.data["asset"], "AVALON_ASSET": instance.context.data["asset"],
"AVALON_TASK": instance.context.data["task"], "AVALON_TASK": instance.context.data["task"],
"OPENPYPE_USERNAME": instance.context.data["user"], "OPENPYPE_USERNAME": instance.context.data["user"],
"OPENPYPE_LOG_NO_COLORS": "1", "AYON_LOG_NO_COLORS": "1",
"IS_TEST": str(int(is_in_tests())), "IS_TEST": str(int(is_in_tests())),
"AYON_PUBLISH_JOB": "1", "AYON_PUBLISH_JOB": "1",
"AYON_RENDER_JOB": "0", "AYON_RENDER_JOB": "0",