2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
6 LilyPond 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.
11 LilyPond 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.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
23 #include "std-string.hh"
25 /* Log-level bitmasks */
27 #define LOG_ERROR 1<<0
29 #define LOG_BASIC 1<<2 // undocumented basic_progress, i.e. input file name and success
30 #define LOG_PROGRESS 1<<3
32 #define LOG_DEBUG 1<<8
34 /* Log-level definitions (or'ed bitmasks) */
35 #define LOGLEVEL_NONE (LOG_NONE)
36 #define LOGLEVEL_ERROR (LOG_ERROR)
37 #define LOGLEVEL_WARN (LOGLEVEL_ERROR | LOG_WARN)
38 #define LOGLEVEL_BASIC (LOGLEVEL_WARN | LOG_BASIC)
39 #define LOGLEVEL_PROGRESS (LOGLEVEL_BASIC | LOG_PROGRESS)
40 #define LOGLEVEL_INFO (LOGLEVEL_PROGRESS | LOG_INFO)
41 #define LOGLEVEL_DEBUG (LOGLEVEL_INFO | LOG_DEBUG)
44 extern bool warning_as_error;
46 /* output messages, in decreasing order of importance */
47 void error (string s, const string &location = ""); // Fatal error, exits lilypond!
48 void programming_error (const string &s, const string &location = "");
49 void non_fatal_error (const string&, const string &location = "");
50 void warning (const string &s, const string &location = "");
51 void basic_progress (const string &s, const string &location = "");
52 /* progress_indication does by default *NOT* start on a new line */
53 void progress_indication (const string &s, bool newline = false, const string &location = "");
54 void message (const string &s, bool newline = true, const string &location = "");
55 void debug_output (const string &s, bool newline = true, const string &location = "");
57 /* Helper functions that always print out the message. Callers should ensure
58 that the loglevel is obeyed */
59 void print_message (int level, const string &location, string s, bool newline = true);
61 bool is_loglevel (int level);
62 void set_loglevel (int level);
63 void set_loglevel (string level);
65 void expect_warning (const string &msg);
66 void check_expected_warnings ();