-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pw_log_fuchsia: Create pw_log Fuchsia backend
Change-Id: I3672318e535eb9e4a5edf343f79d0053c1d2da96 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/231052 Reviewed-by: Darren Chan <[email protected]> Presubmit-Verified: CQ Bot Account <[email protected]> Reviewed-by: Ted Pudlik <[email protected]> Lint: Lint 🤖 <[email protected]> Reviewed-by: Faraaz Sareshwala <[email protected]> Pigweed-Auto-Submit: Ben Lawson <[email protected]> Commit-Queue: Auto-Submit <[email protected]>
- Loading branch information
1 parent
871fd5f
commit 3dc3f1a
Showing
13 changed files
with
450 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,7 @@ pw_libcxx | |
pw_log | ||
pw_log_android | ||
pw_log_basic | ||
pw_log_fuchsia | ||
pw_log_null | ||
pw_log_rpc | ||
pw_log_string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright 2024 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) | ||
|
||
cc_library( | ||
name = "pw_log_fuchsia", | ||
srcs = [ | ||
"log_fuchsia.cc", | ||
], | ||
hdrs = [ | ||
"public/pw_log_fuchsia/log_backend.h", | ||
"public_overrides/pw_log_backend/log_backend.h", | ||
], | ||
includes = [ | ||
"public", | ||
"public_overrides", | ||
], | ||
target_compatible_with = ["@platforms//os:fuchsia"], | ||
deps = [ | ||
"@fuchsia_sdk//fidl/fuchsia.logger:fuchsia.logger_cpp", | ||
"@fuchsia_sdk//pkg/async-cpp", | ||
"@fuchsia_sdk//pkg/component_incoming_cpp", | ||
"@fuchsia_sdk//pkg/syslog_structured_backend", | ||
"@pigweed//pw_log:facade", | ||
"@pigweed//pw_preprocessor", | ||
"@pigweed//pw_string:builder", | ||
], | ||
) | ||
|
||
# Bazel does not yet support building docs. | ||
filegroup( | ||
name = "docs", | ||
srcs = ["docs.rst"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2024 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
import("//build_overrides/pigweed.gni") | ||
|
||
import("$dir_pw_docgen/docs.gni") | ||
import("$dir_pw_unit_test/test.gni") | ||
|
||
pw_doc_group("docs") { | ||
sources = [ "docs.rst" ] | ||
} | ||
|
||
pw_test_group("tests") { | ||
} | ||
|
||
# Satisfy source_is_in_build_files presubmit step | ||
pw_source_set("satisfy_presubmit") { | ||
sources = [ | ||
"log_fuchsia.cc", | ||
"public/pw_log_fuchsia/log_backend.h", | ||
"public_overrides/pw_log_backend/log_backend.h", | ||
] | ||
visibility = [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2024 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
include($ENV{PW_ROOT}/pw_build/pigweed.cmake) | ||
|
||
|
||
|
||
# CMake does not yet support building docs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[email protected] | ||
[email protected] | ||
[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.. _module-pw_log_fuchsia: | ||
|
||
============== | ||
pw_log_fuchsia | ||
============== | ||
.. pigweed-module:: | ||
:name: pw_log_fuchsia | ||
|
||
-------- | ||
Overview | ||
-------- | ||
The ``pw_log_fuchsia`` module provides a ``PW_HANDLE_LOG`` backend for the | ||
``pw_log`` module. The backend uses the ``fuchsia.logger.LogSink`` FIDL API | ||
to send logs. Only Bazel is supported because the Fuchsia SDK only supports Bazel. | ||
|
||
--- | ||
API | ||
--- | ||
Before logging, ``pw::log_fuchsia::InitializeLogging(async_dispatcher_t*)`` must | ||
be called to initialize the logging state. | ||
|
||
Two log flags are supported to help with logging during tests: | ||
``PW_LOG_FLAG_USE_PRINTF``, which uses printf to log instead of ``LogSink``, | ||
and ``PW_LOG_FLAG_IGNORE``, which skips logging the log. |
Oops, something went wrong.