1# 2# Copyright 2022 The Abseil Authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# https://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17load( 18 "//absl:copts/configure_copts.bzl", 19 "ABSL_DEFAULT_COPTS", 20 "ABSL_DEFAULT_LINKOPTS", 21 "ABSL_TEST_COPTS", 22) 23 24package(default_visibility = [ 25 "//absl/log:__pkg__", 26]) 27 28licenses(["notice"]) 29 30cc_library( 31 name = "check_op", 32 srcs = ["check_op.cc"], 33 hdrs = ["check_op.h"], 34 copts = ABSL_DEFAULT_COPTS, 35 linkopts = ABSL_DEFAULT_LINKOPTS, 36 visibility = [ 37 "//absl/log:__pkg__", 38 ], 39 deps = [ 40 ":nullguard", 41 ":nullstream", 42 ":strip", 43 "//absl/base:config", 44 "//absl/base:core_headers", 45 "//absl/strings", 46 ], 47) 48 49cc_library( 50 name = "conditions", 51 srcs = ["conditions.cc"], 52 hdrs = ["conditions.h"], 53 copts = ABSL_DEFAULT_COPTS, 54 linkopts = ABSL_DEFAULT_LINKOPTS, 55 deps = [ 56 ":voidify", 57 "//absl/base", 58 "//absl/base:config", 59 "//absl/base:core_headers", 60 ], 61) 62 63cc_library( 64 name = "config", 65 hdrs = ["config.h"], 66 copts = ABSL_DEFAULT_COPTS, 67 linkopts = ABSL_DEFAULT_LINKOPTS, 68 visibility = [ 69 "//absl/log:__pkg__", 70 ], 71 deps = [ 72 "//absl/base:config", 73 "//absl/base:core_headers", 74 ], 75) 76 77cc_library( 78 name = "flags", 79 hdrs = ["flags.h"], 80 copts = ABSL_DEFAULT_COPTS, 81 linkopts = ABSL_DEFAULT_LINKOPTS, 82 deps = [ 83 "//absl/flags:flag", 84 ], 85) 86 87cc_library( 88 name = "format", 89 srcs = ["log_format.cc"], 90 hdrs = ["log_format.h"], 91 copts = ABSL_DEFAULT_COPTS, 92 linkopts = ABSL_DEFAULT_LINKOPTS, 93 deps = [ 94 ":config", 95 ":globals", 96 "//absl/base:config", 97 "//absl/base:core_headers", 98 "//absl/base:log_severity", 99 "//absl/strings", 100 "//absl/strings:str_format", 101 "//absl/time", 102 "//absl/types:span", 103 ], 104) 105 106cc_library( 107 name = "globals", 108 srcs = ["globals.cc"], 109 hdrs = ["globals.h"], 110 copts = ABSL_DEFAULT_COPTS, 111 linkopts = ABSL_DEFAULT_LINKOPTS, 112 visibility = [ 113 "//absl/log:__pkg__", 114 ], 115 deps = [ 116 "//absl/base:config", 117 "//absl/base:core_headers", 118 "//absl/base:log_severity", 119 "//absl/base:raw_logging_internal", 120 "//absl/strings", 121 "//absl/time", 122 ], 123) 124 125cc_library( 126 name = "log_message", 127 srcs = ["log_message.cc"], 128 hdrs = ["log_message.h"], 129 copts = ABSL_DEFAULT_COPTS, 130 linkopts = ABSL_DEFAULT_LINKOPTS, 131 visibility = [ 132 "//absl/log:__pkg__", 133 ], 134 deps = [ 135 ":config", 136 ":format", 137 ":globals", 138 ":log_sink_set", 139 ":nullguard", 140 "//absl/base", 141 "//absl/base:config", 142 "//absl/base:core_headers", 143 "//absl/base:errno_saver", 144 "//absl/base:log_severity", 145 "//absl/base:raw_logging_internal", 146 "//absl/base:strerror", 147 "//absl/container:inlined_vector", 148 "//absl/debugging:examine_stack", 149 "//absl/log:globals", 150 "//absl/log:log_entry", 151 "//absl/log:log_sink", 152 "//absl/log:log_sink_registry", 153 "//absl/memory", 154 "//absl/strings", 155 "//absl/strings:str_format", 156 "//absl/time", 157 "//absl/types:span", 158 ], 159) 160 161cc_library( 162 name = "log_sink_set", 163 srcs = ["log_sink_set.cc"], 164 hdrs = ["log_sink_set.h"], 165 copts = ABSL_DEFAULT_COPTS, 166 linkopts = ABSL_DEFAULT_LINKOPTS + select({ 167 "//conditions:default": [], 168 "@platforms//os:android": ["-llog"], 169 }), 170 deps = [ 171 ":config", 172 ":globals", 173 "//absl/base", 174 "//absl/base:config", 175 "//absl/base:core_headers", 176 "//absl/base:log_severity", 177 "//absl/base:raw_logging_internal", 178 "//absl/cleanup", 179 "//absl/log:globals", 180 "//absl/log:log_entry", 181 "//absl/log:log_sink", 182 "//absl/strings", 183 "//absl/synchronization", 184 "//absl/types:span", 185 ], 186) 187 188cc_library( 189 name = "nullguard", 190 hdrs = ["nullguard.h"], 191 copts = ABSL_DEFAULT_COPTS, 192 linkopts = ABSL_DEFAULT_LINKOPTS, 193 deps = [ 194 "//absl/base:config", 195 ], 196) 197 198cc_library( 199 name = "nullstream", 200 hdrs = ["nullstream.h"], 201 copts = ABSL_DEFAULT_COPTS, 202 linkopts = ABSL_DEFAULT_LINKOPTS, 203 deps = [ 204 "//absl/base:config", 205 "//absl/base:core_headers", 206 "//absl/base:log_severity", 207 "//absl/strings", 208 ], 209) 210 211cc_library( 212 name = "strip", 213 hdrs = ["strip.h"], 214 copts = ABSL_DEFAULT_COPTS, 215 linkopts = ABSL_DEFAULT_LINKOPTS, 216 deps = [ 217 ":log_message", 218 ":nullstream", 219 "//absl/base:log_severity", 220 ], 221) 222 223cc_library( 224 name = "test_actions", 225 testonly = True, 226 srcs = ["test_actions.cc"], 227 hdrs = ["test_actions.h"], 228 copts = ABSL_DEFAULT_COPTS, 229 linkopts = ABSL_DEFAULT_LINKOPTS, 230 deps = [ 231 ":config", 232 "//absl/base:config", 233 "//absl/base:log_severity", 234 "//absl/log:log_entry", 235 "//absl/strings", 236 "//absl/time", 237 ], 238) 239 240cc_library( 241 name = "test_helpers", 242 testonly = True, 243 srcs = ["test_helpers.cc"], 244 hdrs = ["test_helpers.h"], 245 copts = ABSL_DEFAULT_COPTS, 246 linkopts = ABSL_DEFAULT_LINKOPTS, 247 deps = [ 248 ":globals", 249 "//absl/base:config", 250 "//absl/base:log_severity", 251 "//absl/log:globals", 252 "//absl/log:initialize", 253 "@com_google_googletest//:gtest", 254 ], 255) 256 257cc_library( 258 name = "test_matchers", 259 testonly = True, 260 srcs = ["test_matchers.cc"], 261 hdrs = ["test_matchers.h"], 262 copts = ABSL_DEFAULT_COPTS, 263 linkopts = ABSL_DEFAULT_LINKOPTS, 264 deps = [ 265 ":config", 266 ":test_helpers", 267 "//absl/base:config", 268 "//absl/base:log_severity", 269 "//absl/log:log_entry", 270 "//absl/strings", 271 "//absl/time", 272 "@com_google_googletest//:gtest", 273 ], 274) 275 276cc_library( 277 name = "voidify", 278 hdrs = ["voidify.h"], 279 copts = ABSL_DEFAULT_COPTS, 280 linkopts = ABSL_DEFAULT_LINKOPTS, 281 deps = ["//absl/base:config"], 282) 283 284# Test targets 285cc_test( 286 name = "stderr_log_sink_test", 287 size = "small", 288 srcs = ["stderr_log_sink_test.cc"], 289 copts = ABSL_TEST_COPTS, 290 linkopts = ABSL_DEFAULT_LINKOPTS, 291 tags = [ 292 "no_test:os:android", 293 "no_test:os:ios", 294 "no_test_android", 295 "no_test_darwin_x86_64", 296 "no_test_ios", 297 "no_test_wasm", 298 ], 299 deps = [ 300 ":test_helpers", 301 "//absl/base:core_headers", 302 "//absl/base:log_severity", 303 "//absl/log", 304 "//absl/log:globals", 305 "@com_google_googletest//:gtest_main", 306 ], 307) 308