• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_impl",
32    hdrs = ["check_impl.h"],
33    copts = ABSL_DEFAULT_COPTS,
34    linkopts = ABSL_DEFAULT_LINKOPTS,
35    deps = [
36        ":check_op",
37        ":conditions",
38        ":log_message",
39        ":strip",
40        "//absl/base:core_headers",
41    ],
42)
43
44cc_library(
45    name = "check_op",
46    srcs = ["check_op.cc"],
47    hdrs = ["check_op.h"],
48    copts = ABSL_DEFAULT_COPTS,
49    linkopts = ABSL_DEFAULT_LINKOPTS,
50    visibility = [
51        "//absl/log:__pkg__",
52    ],
53    deps = [
54        ":nullguard",
55        ":nullstream",
56        ":strip",
57        "//absl/base:config",
58        "//absl/base:core_headers",
59        "//absl/strings",
60    ],
61)
62
63cc_library(
64    name = "conditions",
65    srcs = ["conditions.cc"],
66    hdrs = ["conditions.h"],
67    copts = ABSL_DEFAULT_COPTS,
68    linkopts = ABSL_DEFAULT_LINKOPTS,
69    deps = [
70        ":voidify",
71        "//absl/base",
72        "//absl/base:config",
73        "//absl/base:core_headers",
74    ],
75)
76
77cc_library(
78    name = "config",
79    hdrs = ["config.h"],
80    copts = ABSL_DEFAULT_COPTS,
81    linkopts = ABSL_DEFAULT_LINKOPTS,
82    visibility = [
83        "//absl/log:__pkg__",
84    ],
85    deps = [
86        "//absl/base:config",
87        "//absl/base:core_headers",
88    ],
89)
90
91cc_library(
92    name = "flags",
93    hdrs = ["flags.h"],
94    copts = ABSL_DEFAULT_COPTS,
95    linkopts = ABSL_DEFAULT_LINKOPTS,
96    deps = [
97        "//absl/flags:flag",
98    ],
99)
100
101cc_library(
102    name = "format",
103    srcs = ["log_format.cc"],
104    hdrs = ["log_format.h"],
105    copts = ABSL_DEFAULT_COPTS,
106    linkopts = ABSL_DEFAULT_LINKOPTS,
107    deps = [
108        ":append_truncated",
109        ":config",
110        ":globals",
111        "//absl/base:config",
112        "//absl/base:core_headers",
113        "//absl/base:log_severity",
114        "//absl/strings",
115        "//absl/strings:str_format",
116        "//absl/time",
117        "//absl/types:span",
118    ],
119)
120
121cc_library(
122    name = "globals",
123    srcs = ["globals.cc"],
124    hdrs = ["globals.h"],
125    copts = ABSL_DEFAULT_COPTS,
126    linkopts = ABSL_DEFAULT_LINKOPTS,
127    visibility = [
128        "//absl/log:__pkg__",
129    ],
130    deps = [
131        "//absl/base:config",
132        "//absl/base:core_headers",
133        "//absl/base:log_severity",
134        "//absl/base:raw_logging_internal",
135        "//absl/strings",
136        "//absl/time",
137    ],
138)
139
140cc_library(
141    name = "log_impl",
142    hdrs = ["log_impl.h"],
143    copts = ABSL_DEFAULT_COPTS,
144    linkopts = ABSL_DEFAULT_LINKOPTS,
145    deps = [
146        ":conditions",
147        ":log_message",
148        ":strip",
149    ],
150)
151
152cc_library(
153    name = "log_message",
154    srcs = ["log_message.cc"],
155    hdrs = ["log_message.h"],
156    copts = ABSL_DEFAULT_COPTS,
157    linkopts = ABSL_DEFAULT_LINKOPTS,
158    visibility = [
159        "//absl/log:__pkg__",
160    ],
161    deps = [
162        ":append_truncated",
163        ":format",
164        ":globals",
165        ":log_sink_set",
166        ":nullguard",
167        ":proto",
168        "//absl/base",
169        "//absl/base:config",
170        "//absl/base:core_headers",
171        "//absl/base:errno_saver",
172        "//absl/base:log_severity",
173        "//absl/base:raw_logging_internal",
174        "//absl/base:strerror",
175        "//absl/container:inlined_vector",
176        "//absl/debugging:examine_stack",
177        "//absl/log:globals",
178        "//absl/log:log_entry",
179        "//absl/log:log_sink",
180        "//absl/log:log_sink_registry",
181        "//absl/memory",
182        "//absl/strings",
183        "//absl/time",
184        "//absl/types:span",
185    ],
186)
187
188cc_library(
189    name = "append_truncated",
190    hdrs = ["append_truncated.h"],
191    copts = ABSL_DEFAULT_COPTS,
192    linkopts = ABSL_DEFAULT_LINKOPTS,
193    deps = [
194        "//absl/base:config",
195        "//absl/strings",
196        "//absl/types:span",
197    ],
198)
199
200cc_library(
201    name = "log_sink_set",
202    srcs = ["log_sink_set.cc"],
203    hdrs = ["log_sink_set.h"],
204    copts = ABSL_DEFAULT_COPTS,
205    linkopts = ABSL_DEFAULT_LINKOPTS + select({
206        "//conditions:default": [],
207        "@platforms//os:android": ["-llog"],
208    }),
209    deps = [
210        ":config",
211        ":globals",
212        "//absl/base",
213        "//absl/base:config",
214        "//absl/base:core_headers",
215        "//absl/base:log_severity",
216        "//absl/base:raw_logging_internal",
217        "//absl/cleanup",
218        "//absl/log:globals",
219        "//absl/log:log_entry",
220        "//absl/log:log_sink",
221        "//absl/strings",
222        "//absl/synchronization",
223        "//absl/types:span",
224    ],
225)
226
227cc_library(
228    name = "nullguard",
229    srcs = ["nullguard.cc"],
230    hdrs = ["nullguard.h"],
231    copts = ABSL_DEFAULT_COPTS,
232    linkopts = ABSL_DEFAULT_LINKOPTS,
233    deps = [
234        "//absl/base:config",
235        "//absl/base:core_headers",
236    ],
237)
238
239cc_library(
240    name = "nullstream",
241    hdrs = ["nullstream.h"],
242    copts = ABSL_DEFAULT_COPTS,
243    linkopts = ABSL_DEFAULT_LINKOPTS,
244    deps = [
245        "//absl/base:config",
246        "//absl/base:core_headers",
247        "//absl/base:log_severity",
248        "//absl/strings",
249    ],
250)
251
252cc_library(
253    name = "strip",
254    hdrs = ["strip.h"],
255    copts = ABSL_DEFAULT_COPTS,
256    linkopts = ABSL_DEFAULT_LINKOPTS,
257    deps = [
258        ":log_message",
259        ":nullstream",
260        "//absl/base:log_severity",
261    ],
262)
263
264cc_library(
265    name = "structured",
266    hdrs = ["structured.h"],
267    copts = ABSL_DEFAULT_COPTS,
268    linkopts = ABSL_DEFAULT_LINKOPTS,
269    deps = [
270        ":log_message",
271        "//absl/base:config",
272        "//absl/strings",
273    ],
274)
275
276cc_library(
277    name = "test_actions",
278    testonly = True,
279    srcs = ["test_actions.cc"],
280    hdrs = ["test_actions.h"],
281    copts = ABSL_DEFAULT_COPTS,
282    linkopts = ABSL_DEFAULT_LINKOPTS,
283    deps = [
284        "//absl/base:config",
285        "//absl/base:core_headers",
286        "//absl/base:log_severity",
287        "//absl/log:log_entry",
288        "//absl/strings",
289        "//absl/time",
290    ] + select({
291        "//absl:msvc_compiler": [],
292        "//conditions:default": [
293        ],
294    }),
295)
296
297cc_library(
298    name = "test_helpers",
299    testonly = True,
300    srcs = ["test_helpers.cc"],
301    hdrs = ["test_helpers.h"],
302    copts = ABSL_DEFAULT_COPTS,
303    linkopts = ABSL_DEFAULT_LINKOPTS,
304    deps = [
305        ":globals",
306        "//absl/base:config",
307        "//absl/base:log_severity",
308        "//absl/log:globals",
309        "//absl/log:initialize",
310        "@com_google_googletest//:gtest",
311    ],
312)
313
314cc_library(
315    name = "test_matchers",
316    testonly = True,
317    srcs = ["test_matchers.cc"],
318    hdrs = ["test_matchers.h"],
319    copts = ABSL_DEFAULT_COPTS,
320    linkopts = ABSL_DEFAULT_LINKOPTS,
321    deps = [
322        ":test_helpers",
323        "//absl/base:config",
324        "//absl/base:core_headers",
325        "//absl/base:log_severity",
326        "//absl/log:log_entry",
327        "//absl/strings",
328        "//absl/time",
329        "@com_google_googletest//:gtest",
330    ] + select({
331        "//absl:msvc_compiler": [],
332        "//conditions:default": [
333        ],
334    }),
335)
336
337cc_library(
338    name = "voidify",
339    hdrs = ["voidify.h"],
340    copts = ABSL_DEFAULT_COPTS,
341    linkopts = ABSL_DEFAULT_LINKOPTS,
342    deps = ["//absl/base:config"],
343)
344
345cc_library(
346    name = "proto",
347    srcs = ["proto.cc"],
348    hdrs = ["proto.h"],
349    copts = ABSL_DEFAULT_COPTS,
350    linkopts = ABSL_DEFAULT_LINKOPTS,
351    deps = [
352        "//absl/base",
353        "//absl/base:config",
354        "//absl/base:core_headers",
355        "//absl/strings",
356        "//absl/types:span",
357    ],
358)
359
360# Test targets
361cc_test(
362    name = "stderr_log_sink_test",
363    size = "small",
364    srcs = ["stderr_log_sink_test.cc"],
365    copts = ABSL_TEST_COPTS,
366    linkopts = ABSL_DEFAULT_LINKOPTS,
367    tags = [
368        "no_test:os:android",
369        "no_test:os:ios",
370        "no_test_android",
371        "no_test_darwin_x86_64",
372        "no_test_ios",
373        "no_test_wasm",
374    ],
375    deps = [
376        ":test_helpers",
377        "//absl/base:core_headers",
378        "//absl/base:log_severity",
379        "//absl/log",
380        "//absl/log:globals",
381        "@com_google_googletest//:gtest_main",
382    ],
383)
384