summaryrefslogtreecommitdiffstats
path: root/lib/efl/eina_log.rb
blob: 95c46688a8065ddd2087efa4c9a28e8d8b0dbd09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
#require 'efl'
require 'efl/eina'
require 'efl/native/eina_log'
#
module Efl
    #
    module EinaLog
        #
        COLOR_LIGHTRED  ="\033[31;1m"
        COLOR_RED       ="\033[31m"
        COLOR_LIGHTBLUE ="\033[34;1m"
        COLOR_BLUE      ="\033[34m"
        COLOR_GREEN     ="\033[32;1m"
        COLOR_YELLOW    ="\033[33;1m"
        COLOR_ORANGE    ="\033[0;33m"
        COLOR_WHITE     ="\033[37;1m"
        COLOR_LIGHTCYAN ="\033[36;1m"
        COLOR_CYAN      ="\033[36m"
        COLOR_RESET     ="\033[0m"
        COLOR_HIGH      ="\033[1m"
        #
        def self.log_dom_crit dom, lvl, msg
            file, line, func = caller[1].split ':'
            Native.eina_log_print dom, lvl, file, func, line.to_i, msg
        end
        def self.log_dom_crit dom, msg
            self._log_dom dom, :eina_log_level_critical, msg
        end
        def self.log_dom_err dom, msg
            self._log_dom dom, :eina_log_level_err, msg
        end
        def self.log_dom_info dom, msg
            self._log_dom dom, :eina_log_level_info, msg
        end
        def self.log_dom_warn dom, msg
            self._log_dom dom, :eina_log_level_warn, msg
        end
        def self.log_dom_dbg dom, msg
            self._log_dom dom, :eina_log_level_dbg, msg
        end
        # should never be called directly
        def self._log lvl, msg
            file, line, func = caller[1].split ':'
            Native.eina_log_print Native.EINA_LOG_DOMAIN_GLOBAL, lvl, file, func, line.to_i, msg
        end
        #
        def self.log_crit msg
            self._log :eina_log_level_critical, msg
        end
        def self.log_err msg
            self._log :eina_log_level_err, msg
        end
        def self.log_info msg
            self._log :eina_log_level_info, msg
        end
        def self.log_warn msg
            self._log :eina_log_level_warn, msg
        end
        def self.log_dbg msg
            self._log :eina_log_level_dbg, msg
        end
        #
    end
    #
end
#
# EOF