Skip to content

Commit

Permalink
[Linux]Add build arg to allow external logging implementation (#22829)
Browse files Browse the repository at this point in the history
* Linux: add build arg to allow external logging implementation

The will allow target platform/application to provide its own
logging implementation, such as writing logs to file, instead
of logging to stdout.

* Update core.gni
  • Loading branch information
zqiu-nest authored Oct 4, 2022
1 parent 5b1af33 commit fa9f977
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/lib/core/core.gni
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ declare_args() {
# Configure chip logging to output through pigweed logging.
chip_use_pw_logging = false

# Configure chip logging to output through external logging implementation.
# External code will need to provide implementation for CHIP log output
# function (LogV), which is defined in "src/platform/logging/LogV.h".
chip_use_external_logging = false

# Enable short error strings.
chip_config_short_error_str = false

Expand Down
5 changes: 4 additions & 1 deletion src/platform/Linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ static_library("Linux") {
"InetPlatformConfig.h",
"KeyValueStoreManagerImpl.cpp",
"KeyValueStoreManagerImpl.h",
"Logging.cpp",
"NetworkCommissioningDriver.h",
"NetworkCommissioningEthernetDriver.cpp",
"PlatformManagerImpl.cpp",
Expand All @@ -78,6 +77,10 @@ static_library("Linux") {
"SystemTimeSupport.cpp",
]

if (!chip_use_external_logging) {
sources += [ "Logging.cpp" ]
}

if (chip_enable_openthread) {
sources += [ "NetworkCommissioningThreadDriver.cpp" ]
}
Expand Down

0 comments on commit fa9f977

Please sign in to comment.