Debian Codegraph @

Aircraft/c172p/Nasal/generic/logger.nas

raw
1 # Copyright (C) 2014 onox
2 #
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 var error = func (message) {
17 var string = sprintf("Error: %s", message);
18 print(globals.string.color("31;40;1", string));
19 };
20
21 var warn = func (message) {
22 var string = sprintf("Warning: %s", message);
23 print(globals.string.color("33;40;1", string));
24 };
25
26 var info = func (message) {
27 var string = sprintf("Info: %s", message);
28 print(globals.string.color("37;40;1", string));
29 };
30
31 var screen = {
32
33 # Print colored text on the screen
34
35 red: func (message) {
36 globals.screen.log.write(message, 1, 0, 0);
37 },
38
39 green: func (message) {
40 globals.screen.log.write(message, 0, 1.0, 0);
41 },
42
43 blue: func (message) {
44 globals.screen.log.write(message, 0, 0.584, 1);
45 },
46
47 white: func (message) {
48 globals.screen.log.write(message, 1, 1, 1);
49 }
50
51 };