Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix a segfault when Host.getByName(null) is called
[simgrid.git] / testsuite / xbt / log_usage.c
1 /* log_usage - A test of normal usage of the log facilities                 */
2
3 /* Copyright (c) 2004-2007, 2009-2014. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #ifdef __BORLANDC__
10 #pragma hdrstop
11 #endif
12
13 #include "xbt.h"
14
15 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(test, top,
16                                 "Logging specific to this test");
17 XBT_LOG_NEW_CATEGORY(top, "Useless test channel");
18
19 #ifdef __BORLANDC__
20 #pragma argsused
21 #endif
22
23 static void dolog(const char *settings)
24 {
25   XBT_INFO("Test with the settings '%s'", settings);
26   xbt_log_control_set(settings);
27   XBT_DEBUG("val=%d", 1);
28   XBT_WARN("val=%d", 2);
29   XBT_CDEBUG(top, "val=%d%s", 3, "!");
30   XBT_CRITICAL("false alarm%s%s%s%s%s%s", "", "", "", "", "", "!");
31 }
32
33
34 int main(int argc, char **argv)
35 {
36   xbt_init(&argc, argv);
37
38   dolog("");
39   dolog(" ");
40   dolog(" test.thres:info root.thres:info  ");
41 #ifndef NDEBUG
42   dolog(" test.thres:debug ");
43 #endif
44   dolog(" test.thres:verbose root.thres:error ");
45   dolog(" test.thres:critical ");
46
47   return 0;
48 }