• 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(
25    default_visibility = [
26        "//absl/log:__pkg__",
27    ],
28    features = [
29        "header_modules",
30        "layering_check",
31        "parse_headers",
32    ],
33)
34
35licenses(["notice"])
36
37cc_library(
38    name = "check_impl",
39    hdrs = ["check_impl.h"],
40    copts = ABSL_DEFAULT_COPTS,
41    linkopts = ABSL_DEFAULT_LINKOPTS,
42    deps = [
43        ":check_op",
44        ":conditions",
45        ":log_message",
46        ":strip",
47        "//absl/base:core_headers",
48    ],
49)
50
51cc_library(
52    name = "check_op",
53    srcs = ["check_op.cc"],
54    hdrs = ["check_op.h"],
55    copts = ABSL_DEFAULT_COPTS,
56    linkopts = ABSL_DEFAULT_LINKOPTS,
57    visibility = [
58        "//absl/log:__pkg__",
59    ],
60    deps = [
61        ":nullguard",
62        ":nullstream",
63        ":strip",
64        "//absl/base:config",
65        "//absl/base:core_headers",
66        "//absl/base:nullability",
67        "//absl/strings",
68    ],
69)
70
71cc_library(
72    name = "conditions",
73    srcs = ["conditions.cc"],
74    hdrs = ["conditions.h"],
75    copts = ABSL_DEFAULT_COPTS,
76    linkopts = ABSL_DEFAULT_LINKOPTS,
77    deps = [
78        ":voidify",
79        "//absl/base",
80        "//absl/base:config",
81        "//absl/base:core_headers",
82    ],
83)
84
85cc_library(
86    name = "config",
87    hdrs = ["config.h"],
88    copts = ABSL_DEFAULT_COPTS,
89    linkopts = ABSL_DEFAULT_LINKOPTS,
90    visibility = [
91        "//absl/log:__pkg__",
92    ],
93    deps = [
94        "//absl/base:config",
95        "//absl/base:core_headers",
96    ],
97)
98
99cc_library(
100    name = "flags",
101    hdrs = ["flags.h"],
102    copts = ABSL_DEFAULT_COPTS,
103    linkopts = ABSL_DEFAULT_LINKOPTS,
104    deps = [
105        "//absl/flags:flag",
106    ],
107)
108
109cc_library(
110    name = "format",
111    srcs = ["log_format.cc"],
112    hdrs = ["log_format.h"],
113    copts = ABSL_DEFAULT_COPTS,
114    linkopts = ABSL_DEFAULT_LINKOPTS,
115    deps = [
116        ":append_truncated",
117        ":config",
118        ":globals",
119        "//absl/base:config",
120        "//absl/base:core_headers",
121        "//absl/base:log_severity",
122        "//absl/strings",
123        "//absl/strings:str_format",
124        "//absl/time",
125        "//absl/types:span",
126    ],
127)
128
129cc_library(
130    name = "globals",
131    srcs = ["globals.cc"],
132    hdrs = ["globals.h"],
133    copts = ABSL_DEFAULT_COPTS,
134    linkopts = ABSL_DEFAULT_LINKOPTS,
135    visibility = [
136        "//absl/log:__pkg__",
137    ],
138    deps = [
139        "//absl/base:config",
140        "//absl/base:core_headers",
141        "//absl/base:log_severity",
142        "//absl/base:raw_logging_internal",
143        "//absl/strings",
144        "//absl/time",
145    ],
146)
147
148cc_library(
149    name = "log_impl",
150    hdrs = ["log_impl.h"],
151    copts = ABSL_DEFAULT_COPTS,
152    linkopts = ABSL_DEFAULT_LINKOPTS,
153    deps = [
154        ":conditions",
155        ":log_message",
156        ":strip",
157        "//absl/log:absl_vlog_is_on",
158    ],
159)
160
161cc_library(
162    name = "log_message",
163    srcs = ["log_message.cc"],
164    hdrs = ["log_message.h"],
165    copts = ABSL_DEFAULT_COPTS,
166    linkopts = ABSL_DEFAULT_LINKOPTS,
167    visibility = [
168        "//absl/log:__pkg__",
169    ],
170    deps = [
171        ":append_truncated",
172        ":format",
173        ":globals",
174        ":log_sink_set",
175        ":nullguard",
176        ":proto",
177        "//absl/base",
178        "//absl/base:config",
179        "//absl/base:core_headers",
180        "//absl/base:errno_saver",
181        "//absl/base:log_severity",
182        "//absl/base:nullability",
183        "//absl/base:raw_logging_internal",
184        "//absl/base:strerror",
185        "//absl/container:inlined_vector",
186        "//absl/debugging:examine_stack",
187        "//absl/log:globals",
188        "//absl/log:log_entry",
189        "//absl/log:log_sink",
190        "//absl/log:log_sink_registry",
191        "//absl/memory",
192        "//absl/strings",
193        "//absl/time",
194        "//absl/types:span",
195    ],
196)
197
198cc_library(
199    name = "append_truncated",
200    hdrs = ["append_truncated.h"],
201    copts = ABSL_DEFAULT_COPTS,
202    linkopts = ABSL_DEFAULT_LINKOPTS,
203    deps = [
204        "//absl/base:config",
205        "//absl/strings",
206        "//absl/types:span",
207    ],
208)
209
210cc_library(
211    name = "log_sink_set",
212    srcs = ["log_sink_set.cc"],
213    hdrs = ["log_sink_set.h"],
214    copts = ABSL_DEFAULT_COPTS,
215    linkopts = ABSL_DEFAULT_LINKOPTS + select({
216        "//conditions:default": [],
217        "@platforms//os:android": ["-llog"],
218    }),
219    deps = [
220        ":config",
221        ":globals",
222        "//absl/base",
223        "//absl/base:config",
224        "//absl/base:core_headers",
225        "//absl/base:log_severity",
226        "//absl/base:no_destructor",
227        "//absl/base:raw_logging_internal",
228        "//absl/cleanup",
229        "//absl/log:globals",
230        "//absl/log:log_entry",
231        "//absl/log:log_sink",
232        "//absl/strings",
233        "//absl/synchronization",
234        "//absl/types:span",
235    ],
236)
237
238cc_library(
239    name = "nullguard",
240    srcs = ["nullguard.cc"],
241    hdrs = ["nullguard.h"],
242    copts = ABSL_DEFAULT_COPTS,
243    linkopts = ABSL_DEFAULT_LINKOPTS,
244    deps = [
245        "//absl/base:config",
246        "//absl/base:core_headers",
247    ],
248)
249
250cc_library(
251    name = "nullstream",
252    hdrs = ["nullstream.h"],
253    copts = ABSL_DEFAULT_COPTS,
254    linkopts = ABSL_DEFAULT_LINKOPTS,
255    deps = [
256        "//absl/base:config",
257        "//absl/base:core_headers",
258        "//absl/base:log_severity",
259        "//absl/strings",
260    ],
261)
262
263cc_library(
264    name = "strip",
265    hdrs = ["strip.h"],
266    copts = ABSL_DEFAULT_COPTS,
267    linkopts = ABSL_DEFAULT_LINKOPTS,
268    deps = [
269        ":log_message",
270        ":nullstream",
271        "//absl/base:core_headers",
272        "//absl/base:log_severity",
273    ],
274)
275
276cc_library(
277    name = "structured",
278    hdrs = ["structured.h"],
279    copts = ABSL_DEFAULT_COPTS,
280    linkopts = ABSL_DEFAULT_LINKOPTS,
281    deps = [
282        ":log_message",
283        "//absl/base:config",
284        "//absl/base:core_headers",
285        "//absl/strings",
286    ],
287)
288
289cc_library(
290    name = "test_actions",
291    testonly = True,
292    srcs = ["test_actions.cc"],
293    hdrs = ["test_actions.h"],
294    copts = ABSL_DEFAULT_COPTS,
295    linkopts = ABSL_DEFAULT_LINKOPTS,
296    deps = [
297        "//absl/base:config",
298        "//absl/base:core_headers",
299        "//absl/base:log_severity",
300        "//absl/log:log_entry",
301        "//absl/strings",
302        "//absl/time",
303    ] + select({
304        "//absl:msvc_compiler": [],
305        "//conditions:default": [
306        ],
307    }),
308)
309
310cc_library(
311    name = "test_helpers",
312    testonly = True,
313    srcs = ["test_helpers.cc"],
314    hdrs = ["test_helpers.h"],
315    copts = ABSL_DEFAULT_COPTS,
316    linkopts = ABSL_DEFAULT_LINKOPTS,
317    deps = [
318        ":globals",
319        "//absl/base:config",
320        "//absl/base:log_severity",
321        "//absl/log:globals",
322        "//absl/log:initialize",
323        "@com_google_googletest//:gtest",
324    ],
325)
326
327cc_library(
328    name = "test_matchers",
329    testonly = True,
330    srcs = ["test_matchers.cc"],
331    hdrs = ["test_matchers.h"],
332    copts = ABSL_DEFAULT_COPTS,
333    linkopts = ABSL_DEFAULT_LINKOPTS,
334    deps = [
335        ":test_helpers",
336        "//absl/base:config",
337        "//absl/base:core_headers",
338        "//absl/base:log_severity",
339        "//absl/log:log_entry",
340        "//absl/strings",
341        "//absl/time",
342        "@com_google_googletest//:gtest",
343    ] + select({
344        "//absl:msvc_compiler": [],
345        "//conditions:default": [
346        ],
347    }),
348)
349
350cc_library(
351    name = "voidify",
352    hdrs = ["voidify.h"],
353    copts = ABSL_DEFAULT_COPTS,
354    linkopts = ABSL_DEFAULT_LINKOPTS,
355    deps = ["//absl/base:config"],
356)
357
358cc_library(
359    name = "proto",
360    srcs = ["proto.cc"],
361    hdrs = ["proto.h"],
362    copts = ABSL_DEFAULT_COPTS,
363    linkopts = ABSL_DEFAULT_LINKOPTS,
364    deps = [
365        "//absl/base",
366        "//absl/base:config",
367        "//absl/base:core_headers",
368        "//absl/strings",
369        "//absl/types:span",
370    ],
371)
372
373cc_library(
374    name = "fnmatch",
375    srcs = ["fnmatch.cc"],
376    hdrs = ["fnmatch.h"],
377    copts = ABSL_DEFAULT_COPTS,
378    linkopts = ABSL_DEFAULT_LINKOPTS,
379    deps = [
380        "//absl/base:config",
381        "//absl/strings",
382    ],
383)
384
385cc_library(
386    name = "vlog_config",
387    srcs = ["vlog_config.cc"],
388    hdrs = ["vlog_config.h"],
389    copts = ABSL_DEFAULT_COPTS,
390    linkopts = ABSL_DEFAULT_LINKOPTS,
391    visibility = [
392        "//absl/log:__subpackages__",
393    ],
394    deps = [
395        "//absl/base",
396        "//absl/base:config",
397        "//absl/base:core_headers",
398        "//absl/base:no_destructor",
399        "//absl/log/internal:fnmatch",
400        "//absl/memory",
401        "//absl/strings",
402        "//absl/synchronization",
403        "//absl/types:optional",
404    ],
405)
406
407cc_binary(
408    name = "vlog_config_benchmark",
409    testonly = True,
410    srcs = ["vlog_config_benchmark.cc"],
411    copts = ABSL_TEST_COPTS,
412    linkopts = ABSL_DEFAULT_LINKOPTS,
413    tags = [
414        "benchmark",
415    ],
416    visibility = ["//visibility:private"],
417    deps = [
418        ":vlog_config",
419        "//absl/base:config",
420        "//absl/base:core_headers",
421        "//absl/container:layout",
422        "//absl/memory",
423        "//absl/random:distributions",
424        "//absl/strings",
425        "@com_github_google_benchmark//:benchmark_main",
426    ],
427)
428
429# Test targets
430cc_test(
431    name = "stderr_log_sink_test",
432    size = "small",
433    timeout = "moderate",
434    srcs = ["stderr_log_sink_test.cc"],
435    copts = ABSL_TEST_COPTS,
436    linkopts = ABSL_DEFAULT_LINKOPTS,
437    tags = [
438        "no_test:os:android",
439        "no_test:os:ios",
440        "no_test_android",
441        "no_test_darwin_arm64",
442        "no_test_darwin_x86_64",
443        "no_test_fuchsia_x64",
444        "no_test_ios",
445        "no_test_wasm",
446    ],
447    deps = [
448        ":test_helpers",
449        "//absl/base:core_headers",
450        "//absl/base:log_severity",
451        "//absl/log",
452        "//absl/log:globals",
453        "@com_google_googletest//:gtest",
454        "@com_google_googletest//:gtest_main",
455    ],
456)
457
458cc_test(
459    name = "fnmatch_test",
460    srcs = ["fnmatch_test.cc"],
461    copts = ABSL_TEST_COPTS,
462    linkopts = ABSL_DEFAULT_LINKOPTS,
463    deps = [
464        ":fnmatch",
465        "@com_google_googletest//:gtest",
466        "@com_google_googletest//:gtest_main",
467    ],
468)
469
470cc_test(
471    name = "fnmatch_benchmark",
472    srcs = ["fnmatch_benchmark.cc"],
473    copts = ABSL_TEST_COPTS,
474    linkopts = ABSL_DEFAULT_LINKOPTS,
475    tags = ["benchmark"],
476    deps = [
477        ":fnmatch",
478        "@com_github_google_benchmark//:benchmark_main",
479    ],
480)
481