blob: d9e4e94f04f2fee2361e6a876cc210c3f521f657 [file] [log] [blame]
Tyler Chatow67ddb032020-01-12 14:30:04 -08001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
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"],
34 copts = ["-Wno-format-nonliteral"],
Philipp Schraderdada1072020-11-24 11:34:46 -080035 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul011b67a2019-12-15 12:52:34 -080036 visibility = ["//visibility:public"],
37 deps = [
38 "//aos:configuration",
39 "@com_github_google_glog//:glog",
40 ],
41)
42
Brian Silvermancb5da1f2015-12-05 22:19:58 -050043cc_test(
Philipp Schrader9b1790e2018-03-10 20:21:30 -080044 name = "implementations_test",
45 srcs = [
46 "implementations_test.cc",
47 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080048 target_compatible_with = ["@platforms//os:linux"],
Philipp Schrader9b1790e2018-03-10 20:21:30 -080049 deps = [
Philipp Schrader9b1790e2018-03-10 20:21:30 -080050 ":logging",
51 "//aos/testing:googletest",
Brian Silverman1463c092020-10-30 17:28:24 -070052 "@com_github_google_glog//:glog",
Philipp Schrader9b1790e2018-03-10 20:21:30 -080053 ],
Brian Silvermancb5da1f2015-12-05 22:19:58 -050054)
55
Tyler Chatow67ddb032020-01-12 14:30:04 -080056flatbuffer_cc_library(
57 name = "log_message_fbs",
58 srcs = ["log_message.fbs"],
Tyler Chatow67ddb032020-01-12 14:30:04 -080059 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -080060 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080061 visibility = ["//visibility:public"],
Tyler Chatow67ddb032020-01-12 14:30:04 -080062)
Austin Schuha9df9ad2021-06-16 14:49:39 -070063
64cc_static_flatbuffer(
65 name = "log_message_schema",
66 function = "aos::logging::LogMessageFbsSchema",
67 target = ":log_message_fbs_reflection_out",
68 visibility = ["//visibility:public"],
69)
Sarah Newmana7e87932022-04-11 15:00:03 -070070
71flatbuffer_cc_library(
72 name = "dynamic_log_command_fbs",
73 srcs = [
74 "dynamic_log_command.fbs",
75 ],
76 gen_reflections = 1,
77 visibility = ["//visibility:public"],
78)
79
80cc_library(
81 name = "dynamic_logging",
82 srcs = ["dynamic_logging.cc"],
83 hdrs = ["dynamic_logging.h"],
84 visibility = ["//visibility:public"],
85 deps = [
86 ":dynamic_log_command_fbs",
87 "//aos/events:shm_event_loop",
88 "@com_github_google_glog//:glog",
89 ],
90)
91
92cc_test(
93 name = "dynamic_logging_test",
94 srcs = ["dynamic_logging_test.cc"],
95 data = [
96 "//aos/events:pingpong_config",
97 ],
98 deps = [
99 ":dynamic_logging",
100 "//aos/events:simulated_event_loop",
101 "//aos/testing:googletest",
102 "//aos/testing:path",
103 ],
104)