Tyler Chatow | 67ddb03 | 2020-01-12 14:30:04 -0800 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
Austin Schuh | a9df9ad | 2021-06-16 14:49:39 -0700 | [diff] [blame] | 2 | load("//aos:flatbuffers.bzl", "cc_static_flatbuffer") |
Tyler Chatow | 67ddb03 | 2020-01-12 14:30:04 -0800 | [diff] [blame] | 3 | |
Brian Silverman | cb5da1f | 2015-12-05 22:19:58 -0500 | [diff] [blame] | 4 | # The primary client logging interface. |
| 5 | cc_library( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 6 | name = "logging", |
| 7 | srcs = [ |
| 8 | "context.cc", |
Austin Schuh | a0c41ba | 2020-09-10 22:59:14 -0700 | [diff] [blame] | 9 | "implementations.cc", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 10 | "interface.cc", |
| 11 | ], |
| 12 | hdrs = [ |
| 13 | "context.h", |
Austin Schuh | a0c41ba | 2020-09-10 22:59:14 -0700 | [diff] [blame] | 14 | "implementations.h", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 15 | "interface.h", |
| 16 | "logging.h", |
| 17 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 18 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 19 | visibility = ["//visibility:public"], |
| 20 | deps = [ |
Austin Schuh | a0c41ba | 2020-09-10 22:59:14 -0700 | [diff] [blame] | 21 | ":printf_formats", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 22 | ":sizes", |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 23 | "//aos:die", |
| 24 | "//aos:macros", |
| 25 | "//aos/libc:aos_strerror", |
Austin Schuh | a0c41ba | 2020-09-10 22:59:14 -0700 | [diff] [blame] | 26 | "//aos/stl_mutex", |
| 27 | "//aos/time", |
| 28 | "//aos/type_traits", |
Brian Silverman | 1463c09 | 2020-10-30 17:28:24 -0700 | [diff] [blame] | 29 | "@com_github_google_glog//:glog", |
Austin Schuh | a0c41ba | 2020-09-10 22:59:14 -0700 | [diff] [blame] | 30 | "@com_google_absl//absl/base", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 31 | ], |
Brian Silverman | cb5da1f | 2015-12-05 22:19:58 -0500 | [diff] [blame] | 32 | ) |
Austin Schuh | f073651 | 2015-09-07 01:22:16 -0700 | [diff] [blame] | 33 | |
James Kuszmaul | 011b67a | 2019-12-15 12:52:34 -0800 | [diff] [blame] | 34 | cc_library( |
| 35 | name = "log_namer", |
| 36 | srcs = ["log_namer.cc"], |
| 37 | hdrs = ["log_namer.h"], |
| 38 | copts = ["-Wno-format-nonliteral"], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 39 | target_compatible_with = ["@platforms//os:linux"], |
James Kuszmaul | 011b67a | 2019-12-15 12:52:34 -0800 | [diff] [blame] | 40 | visibility = ["//visibility:public"], |
| 41 | deps = [ |
| 42 | "//aos:configuration", |
| 43 | "@com_github_google_glog//:glog", |
| 44 | ], |
| 45 | ) |
| 46 | |
Brian Silverman | 100534c | 2015-09-07 15:51:23 -0400 | [diff] [blame] | 47 | cc_library( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 48 | name = "sizes", |
| 49 | hdrs = [ |
| 50 | "sizes.h", |
| 51 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 52 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 53 | ) |
| 54 | |
Brian Silverman | cb5da1f | 2015-12-05 22:19:58 -0500 | [diff] [blame] | 55 | cc_test( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 56 | name = "implementations_test", |
| 57 | srcs = [ |
| 58 | "implementations_test.cc", |
| 59 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 60 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 61 | deps = [ |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 62 | ":logging", |
| 63 | "//aos/testing:googletest", |
Brian Silverman | 1463c09 | 2020-10-30 17:28:24 -0700 | [diff] [blame] | 64 | "@com_github_google_glog//:glog", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 65 | ], |
Brian Silverman | cb5da1f | 2015-12-05 22:19:58 -0500 | [diff] [blame] | 66 | ) |
| 67 | |
| 68 | cc_library( |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 69 | name = "printf_formats", |
| 70 | hdrs = [ |
| 71 | "printf_formats.h", |
| 72 | ], |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 73 | target_compatible_with = ["@platforms//os:linux"], |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 74 | visibility = ["//visibility:public"], |
| 75 | deps = [ |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 76 | "//aos:macros", |
Philipp Schrader | 9b1790e | 2018-03-10 20:21:30 -0800 | [diff] [blame] | 77 | ], |
Austin Schuh | 044e18b | 2015-10-21 20:17:09 -0700 | [diff] [blame] | 78 | ) |
| 79 | |
Tyler Chatow | 67ddb03 | 2020-01-12 14:30:04 -0800 | [diff] [blame] | 80 | flatbuffer_cc_library( |
| 81 | name = "log_message_fbs", |
| 82 | srcs = ["log_message.fbs"], |
Tyler Chatow | 67ddb03 | 2020-01-12 14:30:04 -0800 | [diff] [blame] | 83 | gen_reflections = 1, |
Philipp Schrader | dada107 | 2020-11-24 11:34:46 -0800 | [diff] [blame] | 84 | target_compatible_with = ["@platforms//os:linux"], |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 85 | visibility = ["//visibility:public"], |
Tyler Chatow | 67ddb03 | 2020-01-12 14:30:04 -0800 | [diff] [blame] | 86 | ) |
Austin Schuh | a9df9ad | 2021-06-16 14:49:39 -0700 | [diff] [blame] | 87 | |
| 88 | cc_static_flatbuffer( |
| 89 | name = "log_message_schema", |
| 90 | function = "aos::logging::LogMessageFbsSchema", |
| 91 | target = ":log_message_fbs_reflection_out", |
| 92 | visibility = ["//visibility:public"], |
| 93 | ) |
Sarah Newman | a7e8793 | 2022-04-11 15:00:03 -0700 | [diff] [blame] | 94 | |
| 95 | flatbuffer_cc_library( |
| 96 | name = "dynamic_log_command_fbs", |
| 97 | srcs = [ |
| 98 | "dynamic_log_command.fbs", |
| 99 | ], |
| 100 | gen_reflections = 1, |
| 101 | visibility = ["//visibility:public"], |
| 102 | ) |
| 103 | |
| 104 | cc_library( |
| 105 | name = "dynamic_logging", |
| 106 | srcs = ["dynamic_logging.cc"], |
| 107 | hdrs = ["dynamic_logging.h"], |
| 108 | visibility = ["//visibility:public"], |
| 109 | deps = [ |
| 110 | ":dynamic_log_command_fbs", |
| 111 | "//aos/events:shm_event_loop", |
| 112 | "@com_github_google_glog//:glog", |
| 113 | ], |
| 114 | ) |
| 115 | |
| 116 | cc_test( |
| 117 | name = "dynamic_logging_test", |
| 118 | srcs = ["dynamic_logging_test.cc"], |
| 119 | data = [ |
| 120 | "//aos/events:pingpong_config", |
| 121 | ], |
| 122 | deps = [ |
| 123 | ":dynamic_logging", |
| 124 | "//aos/events:simulated_event_loop", |
| 125 | "//aos/testing:googletest", |
| 126 | "//aos/testing:path", |
| 127 | ], |
| 128 | ) |