File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11def et_logging_enabled ():
22 return native .read_config ("executorch" , "enable_et_log" , "true" ) == "true"
33
4+ def is_oss ():
5+ return native .read_config ("executorch" , "is_oss" , "0" ) == "1"
6+
47def et_log_level ():
58 raw_level = native .read_config ("executorch" , "log_level" , "Info" ).lower ()
69 if raw_level == "debug" :
@@ -16,7 +19,14 @@ def et_log_level():
1619
1720def get_et_logging_flags ():
1821 if et_logging_enabled ():
19- # On by default.
20- return ["-DET_MIN_LOG_LEVEL=" + et_log_level ()]
22+ if is_oss ():
23+ return ["-DET_MIN_LOG_LEVEL=" + et_log_level ()]
24+
25+ # On by default; allow opt-out via constraint (the executorch.enable_et_log
26+ # buckconfig above remains an independent way to disable logging).
27+ return select ({
28+ "DEFAULT" : ["-DET_MIN_LOG_LEVEL=" + et_log_level ()],
29+ "fbsource//xplat/executorch/tools/buck/constraints:executorch-et-log-disabled" : ["-DET_LOG_ENABLED=0" ],
30+ })
2131 else :
2232 return ["-DET_LOG_ENABLED=0" ]
Original file line number Diff line number Diff line change @@ -99,3 +99,22 @@ fb_native.constraint_value(
9999 constraint_setting = ":executorch-builtin-function-name" ,
100100 visibility = ["PUBLIC" ],
101101)
102+
103+ fb_native .config_setting (
104+ name = "executorch-et-log-disabled" ,
105+ constraint_values = [
106+ ":et-log-disabled" ,
107+ ],
108+ visibility = ["PUBLIC" ],
109+ )
110+
111+ fb_native .constraint_setting (
112+ name = "executorch-et-log" ,
113+ visibility = ["PUBLIC" ],
114+ )
115+
116+ fb_native .constraint_value (
117+ name = "et-log-disabled" ,
118+ constraint_setting = ":executorch-et-log" ,
119+ visibility = ["PUBLIC" ],
120+ )
You can’t perform that action at this time.
0 commit comments