/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to src/libvee/logger.vala

  • Committer: Gustav Hartvigsson
  • Date: 2024-12-21 23:51:45 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20241221235145-4metak6z6u6vf6b0
[General] Major refactoring. Utils -> Vee nenaming.
Todo: Split libvee into a different library??

Also: Fixed spelling mistakes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
/*
5
5
 * Public Domain.
6
6
 */
7
 
[CCode (cname = "V", cprefix = "v_")]
8
 
namespace Utils {
 
7
 
 
8
namespace Vee {
9
9
  
10
10
  /**
11
11
   * This is a cheap logger, do not use for production code,
13
13
   *
14
14
   * Use GLib's logging capabilities instead.
15
15
   */
16
 
  [CCode (cname = "VLogger", cprefix = "v_logger_")]
17
16
  public class Logger {
18
17
    private const string STR_ERROR = "[ERROR]: ";
19
18
    private const string STR_INFO = "[INFO]: ";
21
20
    
22
21
    private static Logger logger = null;
23
22
    
24
 
    [CCode (cname = "v_logger_new")]
25
23
    public Logger (FILE out_file) {
26
24
      this.out_file = out_file;
27
25
    }
28
26
    
29
 
    [CCode (cname = "v_logger_get_default")]
30
27
    public static Logger get_default () {
31
28
      if (logger == null) {
32
29
         Logger.logger = new Logger (Posix.stdout);
38
35
      Logger.logger = logger;
39
36
    }
40
37
    
41
 
    [CCode (cname = "v_logger_err")]
42
38
    public void error (string str, ...) {
43
39
      out_file.printf (STR_ERROR);
44
40
      out_file.printf (str, va_list());
45
41
    }
46
42
    
47
 
    [CCode (cname = "v_logger_info")]
48
43
    public void info (string str, ...) {
49
44
      out_file.printf (STR_INFO);
50
45
      out_file.printf (str, va_list());
51
46
    }
52
47
    
53
 
    [CCode (cname = "v_logger_free_default")]
54
48
    public static void free_default () {
55
49
      Posix.free(Logger.logger);
56
50
    }