log.h (2157B)
1/* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 21#ifndef __GUACD_LOG_H 22#define __GUACD_LOG_H 23 24#include "config.h" 25 26#include <guacamole/client.h> 27 28/** 29 * The maximum level at which to log messages. All other messages will be 30 * dropped. 31 */ 32extern int guacd_log_level; 33 34/** 35 * The string to prepend to all log messages. 36 */ 37#define GUACD_LOG_NAME "guacd" 38 39/** 40 * Writes a message to guacd's logs. This function takes a format and va_list, 41 * similar to vprintf. 42 */ 43void vguacd_log(guac_client_log_level level, const char* format, va_list args); 44 45/** 46 * Writes a message to guacd's logs. This function accepts parameters 47 * identically to printf. 48 */ 49void guacd_log(guac_client_log_level level, const char* format, ...); 50 51/** 52 * Writes a message using the logging facilities of the given client. This 53 * function accepts parameters identically to printf. 54 */ 55void guacd_client_log(guac_client* client, guac_client_log_level level, 56 const char* format, va_list args); 57 58/** 59 * Prints an error message to guacd's logs, automatically including any 60 * information present in guac_error. This function accepts parameters 61 * identically to printf. 62 */ 63void guacd_log_guac_error(guac_client_log_level level, const char* message); 64 65/** 66 * Logs a reasonable explanatory message regarding handshake failure based on 67 * the current value of guac_error. 68 */ 69void guacd_log_handshake_failure(); 70 71#endif 72