1 /*
2  * Copyright 2019 Daniel Silverstone <dsilvers@netsurf-browser.org>
3  *
4  * This file is part of NetSurf, http://www.netsurf-browser.org/
5  *
6  * NetSurf 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; version 2 of the License.
9  *
10  * NetSurf is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 /**
20  * \file
21  * Browser window console stuff
22  */
23 
24 #ifndef _NETSURF_CONSOLE_H_
25 #define _NETSURF_CONSOLE_H_
26 
27 /**
28  * Sources of messages which end up in the browser window console
29  */
30 typedef enum {
31 	BW_CS_INPUT, /**< Input from the client */
32 	BW_CS_SCRIPT_ERROR, /**< Error from some running script */
33 	BW_CS_SCRIPT_CONSOLE, /**< Logging from some running script */
34 } browser_window_console_source;
35 
36 /**
37  * Flags for browser window console logging.
38  *
39  * It is valid to bitwise-or some of these flags together where indicated.
40  */
41 typedef enum {
42 	/**
43 	 * The log entry is foldable.
44 	 *
45 	 * Set this to indicate that the text should be folded on the first
46 	 * newline on display.  If this is set but there are no newlines in
47 	 * the logged text, the core will unset it before passing on to
48 	 * callbacks or storing the log entry.
49 	 */
50 	BW_CS_FLAG_FOLDABLE = 1 << 0,
51 
52 	/** Logged at the 'debug' level, please use only one of the LEVEL flags */
53 	BW_CS_FLAG_LEVEL_DEBUG = 0 << 1,
54 	/** Logged at the 'log' level, please only use one of the LEVEL flags */
55 	BW_CS_FLAG_LEVEL_LOG = 1 << 1,
56 	/** Logged at the 'info' level, please use only one of the LEVEL flags */
57 	BW_CS_FLAG_LEVEL_INFO = 2 << 1,
58 	/** Logged at the 'warn' level, please use only one of the LEVEL flags */
59 	BW_CS_FLAG_LEVEL_WARN = 3 << 1,
60 	/** Logged at the 'error' level, please use only one of the LEVEL flags */
61 	BW_CS_FLAG_LEVEL_ERROR = 4 << 1,
62 	/* Levels 5, 6, 7 unused as yet */
63 	/** Mask for the error level to allow easy comparison using the above */
64 	BW_CS_FLAG_LEVEL_MASK = 7 << 1,
65 } browser_window_console_flags;
66 
67 #endif /* _NETSURF_CONSOLE_H_ */
68 
69