Project

General

Profile

Revision 5e03b78d

ID5e03b78d5aacaf06e74917ba3dc386df46646e03
Parent 5e8f735d
Child cc7646f9

Added by Thomas Mullins almost 11 years ago

Added new logging functions which inject timestamps

View differences:

mainbox/main.c
1 1
#include "tool.h"
2 2
#include "query.h"
3
#include "log.h"
3 4
#include <unistd.h>
4 5
#include <signal.h>
5 6
#include <strings.h>
......
59 60
    }
60 61
  }
61 62

  
62
  printf("Serial device: %s\n", device);
63
  printf("CRM server: http://%s/\n", server);
63
  log_print("Serial device: %s", device);
64
  log_print("CRM server: http://%s/", server);
64 65

  
65 66
  bzero(&sigact, sizeof(sigact));
66 67
  sigact.sa_handler = sigint;
......
76 77
    return 1;
77 78
  }
78 79

  
79
  printf("Modbus initialized; polling tools...\n");
80
  log_print("Modbus initialized; polling tools...");
80 81

  
81 82
  i = 0;
82 83
  while (run) {
......
86 87
    i = (i+1) % N_TOOLS;
87 88
  }
88 89

  
89
  printf("\nDisabling tools\n");
90
  log_print("Disabling tools");
90 91
  for (i = 0; i < N_TOOLS; i++) {
91 92
    tool_request_disable(&tools[i]);
92 93
  }
93 94

  
94
  printf("Closing modbus connection\n");
95
  log_print("Closing modbus connection");
95 96
  tool_close_mb();
96 97

  
97
  printf("Exiting\n");
98
  log_print("Exiting");
98 99
  return 0;
99 100
}

Also available in: Unified diff