1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
26 static const char tag[] = "Android";
27 static const char msg[] = "Android Logger Test";
29 static const char debugMsg[] = "this is a DEBUG message";
30 static const char infoMsg[] = "this is a INFO message";
31 static const char warningMsg[] = "this is a WARNING message";
32 static const char errorMsg[] = "this is a ERROR message";
33 static const char fatalMsg[] = "this is a FATAL message";
35 static const char multiLineMsg[] = "this is a DEBUG message\non multiple\nlines";
38 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
42 OIC_LOG(INFO, tag, msg);
46 OIC_LOG(INFO, 0, msg);
50 OIC_LOG(INFO, tag, 0);
58 OIC_LOG(DEBUG, tag, debugMsg);
59 OIC_LOG(INFO, tag, infoMsg);
60 OIC_LOG(WARNING, tag, warningMsg);
61 OIC_LOG(ERROR, tag, errorMsg);
62 OIC_LOG(FATAL, tag, fatalMsg);
66 OIC_LOG(DEBUG, tag, multiLineMsg);
73 for (int i = 0; i < (int)(sizeof buffer); i++) {
76 OIC_LOG_BUFFER(DEBUG, tag, buffer, sizeof buffer);
78 // Log buffer, 128 bytes is a good boundary (8 rows of 16 values)
80 for (int i = 0; i < (int)(sizeof buffer1); i++) {
83 OIC_LOG_BUFFER(DEBUG, tag, buffer1, sizeof buffer1);
85 // 1 below 128 byte boundary
87 for (int i = 0; i < (int)(sizeof buffer2); i++) {
90 OIC_LOG_BUFFER(DEBUG, tag, buffer2, sizeof buffer2);
92 // 1 above 128 byte boundary
94 for (int i = 0; i < (int)(sizeof buffer3); i++) {
97 OIC_LOG_BUFFER(DEBUG, tag, buffer3, sizeof buffer3);
100 static void test7() {
101 OIC_LOG_V(DEBUG, tag, "this is a char: %c", 'A');
102 OIC_LOG_V(DEBUG, tag, "this is an integer: %d", 123);
103 OIC_LOG_V(DEBUG, tag, "this is a string: %s", "hello");
104 OIC_LOG_V(DEBUG, tag, "this is a float: %5.2f", 123.45);
107 //-----------------------------------------------------------------------------
109 //-----------------------------------------------------------------------------
111 OIC_LOG(INFO, tag, "Starting logger test");