blob: 9bd4807e0da4f5905adf6b26cc496600e263c9af [file] [log] [blame]
James Kuszmaulf01da392023-12-14 11:22:14 -08001load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
Austin Schuha9df9ad2021-06-16 14:49:39 -07002load("//aos:flatbuffers.bzl", "cc_static_flatbuffer")
Tyler Chatow67ddb032020-01-12 14:30:04 -08003
Brian Silvermancb5da1f2015-12-05 22:19:58 -05004# The primary client logging interface.
5cc_library(
Philipp Schrader9b1790e2018-03-10 20:21:30 -08006 name = "logging",
7 srcs = [
8 "context.cc",
Austin Schuha0c41ba2020-09-10 22:59:14 -07009 "implementations.cc",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080010 "interface.cc",
Austin Schuh7bb558e2023-08-30 20:50:51 -070011 "printf_formats.h",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080012 ],
13 hdrs = [
14 "context.h",
Austin Schuha0c41ba2020-09-10 22:59:14 -070015 "implementations.h",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080016 "interface.h",
17 "logging.h",
18 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080019 target_compatible_with = ["@platforms//os:linux"],
Philipp Schrader9b1790e2018-03-10 20:21:30 -080020 visibility = ["//visibility:public"],
21 deps = [
John Park33858a32018-09-28 23:05:48 -070022 "//aos:die",
23 "//aos:macros",
24 "//aos/libc:aos_strerror",
Austin Schuha0c41ba2020-09-10 22:59:14 -070025 "//aos/time",
Brian Silverman1463c092020-10-30 17:28:24 -070026 "@com_github_google_glog//:glog",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080027 ],
Brian Silvermancb5da1f2015-12-05 22:19:58 -050028)
Austin Schuhf0736512015-09-07 01:22:16 -070029
James Kuszmaul011b67a2019-12-15 12:52:34 -080030cc_library(
31 name = "log_namer",
32 srcs = ["log_namer.cc"],
33 hdrs = ["log_namer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -080034 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul011b67a2019-12-15 12:52:34 -080035 visibility = ["//visibility:public"],
36 deps = [
37 "//aos:configuration",
38 "@com_github_google_glog//:glog",
39 ],
40)
41
Brian Silvermancb5da1f2015-12-05 22:19:58 -050042cc_test(
Philipp Schrader9b1790e2018-03-10 20:21:30 -080043 name = "implementations_test",
44 srcs = [
45 "implementations_test.cc",
46 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["@platforms//os:linux"],
Philipp Schrader9b1790e2018-03-10 20:21:30 -080048 deps = [
Philipp Schrader9b1790e2018-03-10 20:21:30 -080049 ":logging",
50 "//aos/testing:googletest",
Brian Silverman1463c092020-10-30 17:28:24 -070051 "@com_github_google_glog//:glog",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080052 ],
Brian Silvermancb5da1f2015-12-05 22:19:58 -050053)
54
James Kuszmaulf01da392023-12-14 11:22:14 -080055static_flatbuffer(
Tyler Chatow67ddb032020-01-12 14:30:04 -080056 name = "log_message_fbs",
57 srcs = ["log_message.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -080058 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080059 visibility = ["//visibility:public"],
Tyler Chatow67ddb032020-01-12 14:30:04 -080060)
Austin Schuha9df9ad2021-06-16 14:49:39 -070061
62cc_static_flatbuffer(
63 name = "log_message_schema",
64 function = "aos::logging::LogMessageFbsSchema",
65 target = ":log_message_fbs_reflection_out",
66 visibility = ["//visibility:public"],
67)
Sarah Newmana7e87932022-04-11 15:00:03 -070068
James Kuszmaulf01da392023-12-14 11:22:14 -080069static_flatbuffer(
Sarah Newmana7e87932022-04-11 15:00:03 -070070 name = "dynamic_log_command_fbs",
71 srcs = [
72 "dynamic_log_command.fbs",
73 ],
Sarah Newmana7e87932022-04-11 15:00:03 -070074 visibility = ["//visibility:public"],
75)
76
77cc_library(
78 name = "dynamic_logging",
79 srcs = ["dynamic_logging.cc"],
80 hdrs = ["dynamic_logging.h"],
81 visibility = ["//visibility:public"],
82 deps = [
83 ":dynamic_log_command_fbs",
84 "//aos/events:shm_event_loop",
85 "@com_github_google_glog//:glog",
86 ],
87)
88
89cc_test(
90 name = "dynamic_logging_test",
91 srcs = ["dynamic_logging_test.cc"],
92 data = [
93 "//aos/events:pingpong_config",
94 ],
95 deps = [
96 ":dynamic_logging",
97 "//aos/events:simulated_event_loop",
98 "//aos/testing:googletest",
99 "//aos/testing:path",
100 ],
101)