blob: e179d6b8374aad9dce7134d892ab90a808d24efc [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"],
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
Tyler Chatow67ddb032020-01-12 14:30:04 -080055flatbuffer_cc_library(
56 name = "log_message_fbs",
57 srcs = ["log_message.fbs"],
Tyler Chatow67ddb032020-01-12 14:30:04 -080058 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -080059 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080060 visibility = ["//visibility:public"],
Tyler Chatow67ddb032020-01-12 14:30:04 -080061)
Austin Schuha9df9ad2021-06-16 14:49:39 -070062
63cc_static_flatbuffer(
64 name = "log_message_schema",
65 function = "aos::logging::LogMessageFbsSchema",
66 target = ":log_message_fbs_reflection_out",
67 visibility = ["//visibility:public"],
68)
Sarah Newmana7e87932022-04-11 15:00:03 -070069
70flatbuffer_cc_library(
71 name = "dynamic_log_command_fbs",
72 srcs = [
73 "dynamic_log_command.fbs",
74 ],
75 gen_reflections = 1,
76 visibility = ["//visibility:public"],
77)
78
79cc_library(
80 name = "dynamic_logging",
81 srcs = ["dynamic_logging.cc"],
82 hdrs = ["dynamic_logging.h"],
83 visibility = ["//visibility:public"],
84 deps = [
85 ":dynamic_log_command_fbs",
86 "//aos/events:shm_event_loop",
87 "@com_github_google_glog//:glog",
88 ],
89)
90
91cc_test(
92 name = "dynamic_logging_test",
93 srcs = ["dynamic_logging_test.cc"],
94 data = [
95 "//aos/events:pingpong_config",
96 ],
97 deps = [
98 ":dynamic_logging",
99 "//aos/events:simulated_event_loop",
100 "//aos/testing:googletest",
101 "//aos/testing:path",
102 ],
103)