1 /*
2  * lftp - file transfer program
3  *
4  * Copyright (c) 1996-2016 by Alexander V. Lukyanov (lav@yars.free.net)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef PROTOLOG_H
21 #define PROTOLOG_H
22 
23 #include "xstring.h"
24 
25 class ProtoLog
26 {
27    static bool WillOutput(int level);
28 
29    struct Tags : public ResClient {
30       const char *recv;
31       const char *send;
32       const char *note;
33       const char *error;
ReconfigTags34       void Reconfig(const char *n) {
35 	 if(n && strncmp(n,"log:prefix-",11))
36 	    return;
37 	 recv=Query("log:prefix-recv",0);
38 	 send=Query("log:prefix-send",0);
39 	 note=Query("log:prefix-note",0);
40 	 error=Query("log:prefix-error",0);
41       }
42    };
43    static Tags *tags;
44    static void init_tags();
45 
46 public:
47    static void Log2(int level,xstring& str);
48    static void Log3(int level,const char *prefix,const char *str);
49    static void LogVF(int level,const char *prefix,const char *fmt,va_list v);
50    static void LogError(int level,const char *fmt,...) PRINTF_LIKE(2,3);
51    static void LogNote(int level,const char *fmt,...) PRINTF_LIKE(2,3);
52    static void LogRecv(int level,const char *line);
53    static void LogSend(int level,const char *line);
54    static void LogRecvF(int level,const char *fmt,...) PRINTF_LIKE(2,3);
55    static void LogSendF(int level,const char *fmt,...) PRINTF_LIKE(2,3);
56 };
57 
58 #endif//PROTOLOG_H
59