c16533151db0a3b79d41b451cd21d68672322dbf
[nit.git] / lib / android / log.nit
1 # This file is part of NIT (http://www.nitlanguage.org).
2 #
3 # Copyright 2014 Alexis Laferrière <alexis.laf@xymus.net>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 # Advanced Android logging services
18 module log is ldflags "-llog"
19
20 import platform
21
22 in "C" `{
23 #include <android/log.h>
24 `}
25
26 # Default Android log priority
27 protected fun priority_default: Int do return 1
28
29 # Verbose Android log priority
30 protected fun priority_verbose: Int do return 2
31
32 # Debug Android log priority
33 protected fun priority_debug: Int do return 3
34
35 # Info Android log priority
36 protected fun priority_info: Int do return 4
37
38 # Warn Android log priority
39 protected fun priority_warn: Int do return 5
40
41 # Error Android log priority
42 protected fun priority_error: Int do return 6
43
44 # Fatal Android log priority
45 protected fun priority_fatal: Int do return 7
46
47 # Silent Android log priority
48 protected fun priority_silent: Int do return 8
49
50 # Write `text` to Android log at priority `level` with tag `tag`
51 protected fun log_write(level: Int, tag, text: NativeString) `{
52 __android_log_write(level, tag, text);
53 `}