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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
29 static int customLogger = 0;
31 static void PrintUsage()
33 OC_LOG(INFO, TAG, "Usage : test_logging -c <0|1>");
34 OC_LOG(INFO, TAG, "-u <0|1> : 0 - default logging, 1 - custom console logging");
37 int main(int argc, char* argv[])
41 while ((opt = getopt(argc, argv, "c:")) != -1)
46 customLogger = atoi(optarg);
54 if (customLogger == 0)
57 OC_LOG(DEBUG, TAG, "This is a DEBUG");
58 OC_LOG(INFO, TAG, "This is a INFO");
59 OC_LOG(WARNING, TAG, "This is a WARNING");
60 OC_LOG(ERROR, TAG, "This is a ERROR");
61 OC_LOG(FATAL, TAG, "This is a FATAL");
65 // Custom logger, in this case, the console logger
66 oc_log_ctx_t *log = oc_make_console_logger();
70 OC_LOG(DEBUG, TAG, "This is a DEBUG");
71 OC_LOG(INFO, TAG, "This is a INFO");
72 OC_LOG(WARNING, TAG, "This is a WARNING");
73 OC_LOG(ERROR, TAG, "This is a ERROR");
74 OC_LOG(FATAL, TAG, "This is a FATAL");