File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ load ("@fbsource//xplat/executorch/build:runtime_wrapper.bzl" , "runtime" )
2+
13def et_logging_enabled ():
24 return native .read_config ("executorch" , "enable_et_log" , "true" ) == "true"
35
@@ -16,7 +18,14 @@ def et_log_level():
1618
1719def get_et_logging_flags ():
1820 if et_logging_enabled ():
19- # On by default.
20- return ["-DET_MIN_LOG_LEVEL=" + et_log_level ()]
21+ if runtime .is_oss :
22+ return ["-DET_MIN_LOG_LEVEL=" + et_log_level ()]
23+
24+ # On by default; allow opt-out via constraint (the executorch.enable_et_log
25+ # buckconfig above remains an independent way to disable logging).
26+ return select ({
27+ "DEFAULT" : ["-DET_MIN_LOG_LEVEL=" + et_log_level ()],
28+ "fbsource//xplat/executorch/tools/buck/constraints:executorch-et-log-disabled" : ["-DET_LOG_ENABLED=0" ],
29+ })
2130 else :
2231 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