1 /* 2 * logger.h : Public definitions for the Repository Cache 3 * 4 * ==================================================================== 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 * ==================================================================== 22 */ 23 24 #ifndef LOGGER_H 25 #define LOGGER_H 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif /* __cplusplus */ 30 31 #include "server.h" 32 33 34 35 /* Opaque svnserve log file writer data structure. Access to the log 36 * file will be serialized among threads within the same process. 37 */ 38 typedef struct logger_t logger_t; 39 40 /* In POOL, create a writer object that will write log messages to stderr 41 * and return it in *LOGGER. The log file will not add any buffering 42 * on top of stderr. 43 */ 44 svn_error_t * 45 logger__create_for_stderr(logger_t **logger, 46 apr_pool_t *pool); 47 48 /* In POOL, create a writer object for log file FILENAME and return it 49 * in *LOGGER. The log file will be flushed & closed when POOL gets 50 * cleared or destroyed. 51 */ 52 svn_error_t * 53 logger__create(logger_t **logger, 54 const char *filename, 55 apr_pool_t *pool); 56 57 /* Write the first LEN bytes from ERRSTR to the log file managed by LOGGER. 58 */ 59 svn_error_t * 60 logger__write(logger_t *logger, 61 const char *errstr, 62 apr_size_t len); 63 64 /* Write a description of ERR with additional information from REPOSITORY 65 * and CLIENT_INFO to the log file managed by LOGGER. REPOSITORY as well 66 * as CLIENT_INFO may be NULL. If either ERR or LOGGER are NULL, this 67 * becomes a no-op. Does not clear ERR. 68 */ 69 void 70 logger__log_error(logger_t *logger, 71 const svn_error_t *err, 72 repository_t *repository, 73 client_info_t *client_info); 74 75 /* Like logger__log_error() but for warnings. */ 76 void 77 logger__log_warning(logger_t *logger, 78 const svn_error_t *err, 79 repository_t *repository, 80 client_info_t *client_info); 81 82 #ifdef __cplusplus 83 } 84 #endif /* __cplusplus */ 85 86 #endif /* LOGGER_H */ 87