7
[CCode (cname = "V", cprefix = "v_")]
11
* This is a cheap logger, do not use for production code,
12
* it is only for targets where GLib is not available.
14
* Use GLib's logging capabilities instead.
16
[CCode (cname = "VLogger", cprefix = "v_logger_")]
18
private const string STR_ERROR = "[ERROR]: ";
19
private const string STR_INFO = "[INFO]: ";
20
private unowned FILE out_file;
22
private static Logger logger = null;
24
[CCode (cname = "v_logger_new")]
25
public Logger (FILE out_file) {
26
this.out_file = out_file;
29
[CCode (cname = "v_logger_get_default")]
30
public static Logger get_default () {
32
Logger.logger = new Logger (Posix.stdout);
37
public static void set_default (Logger logger) {
38
Logger.logger = logger;
41
[CCode (cname = "v_logger_err")]
42
public void error (string str, ...) {
43
out_file.printf (STR_ERROR);
44
out_file.printf (str, va_list());
47
[CCode (cname = "v_logger_info")]
48
public void info (string str, ...) {
49
out_file.printf (STR_INFO);
50
out_file.printf (str, va_list());
53
[CCode (cname = "v_logger_free_default")]
54
public static void free_default () {
55
Posix.free(Logger.logger);