Apache HTTPD
md_log.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://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
17#include <apr_lib.h>
18#include <apr_strings.h>
19#include <apr_buckets.h>
20
21#include "md_log.h"
22
23#define LOG_BUFFER_LEN 1024
24
25static const char *level_names[] = {
26 "emergency",
27 "alert",
28 "crit",
29 "err",
30 "warning",
31 "notice",
32 "info",
33 "debug",
34 "trace1",
35 "trace2",
36 "trace3",
37 "trace4",
38 "trace5",
39 "trace6",
40 "trace7",
41 "trace8",
42};
43
45{
46 return level_names[level];
47}
48
51static void *log_baton;
52
59
61{
62 if (!log_level) {
63 return 0;
64 }
65 return log_level(log_baton, p, level);
66}
67
68void md_log_perror(const char *file, int line, md_log_level_t level,
69 apr_status_t rv, apr_pool_t *p, const char *fmt, ...)
70{
71 va_list ap;
72
73 va_start(ap, fmt);
74 if (log_printv) {
75 log_printv(file, line, level, rv, log_baton, p, fmt, ap);
76 }
77 va_end(ap);
78}
APR-UTIL Buckets/Bucket Brigades.
APR general purpose library routines.
APR Strings library.
ap_vhost_iterate_conn_cb void * baton
Definition http_vhost.h:87
apr_size_t size
int apr_status_t
Definition apr_errno.h:44
const char apr_file_t * file
apr_vformatter_buff_t const char * fmt
Definition apr_lib.h:175
apr_vformatter_buff_t const char va_list ap
Definition apr_lib.h:176
apr_pool_t * p
Definition md_event.c:32
void md_log_perror(const char *file, int line, md_log_level_t level, apr_status_t rv, apr_pool_t *p, const char *fmt,...)
Definition md_log.c:68
void md_log_set(md_log_level_cb *level_cb, md_log_print_cb *print_cb, void *baton)
Definition md_log.c:53
int md_log_is_level(apr_pool_t *p, md_log_level_t level)
Definition md_log.c:60
static const char * level_names[]
Definition md_log.c:25
static md_log_print_cb * log_printv
Definition md_log.c:49
static md_log_level_cb * log_level
Definition md_log.c:50
const char * md_log_level_name(md_log_level_t level)
Definition md_log.c:44
static void * log_baton
Definition md_log.c:51
void typedef int md_log_level_cb(void *baton, apr_pool_t *p, md_log_level_t level)
void md_log_print_cb(const char *file, int line, md_log_level_t level, apr_status_t rv, void *baton, apr_pool_t *p, const char *fmt, va_list ap)
Definition md_log.h:55
md_log_level_t
Definition md_log.h:20