Project

General

Profile

Revision 55

Added by Jason knichel over 16 years ago

added comments and fixed style a little bit

View differences:

Logging.cpp
1 1
/**
2
 * @file Logging.cpp
2 3
 *
3
 *  @author Jason Knichel
4
 * @brief This file contains the code to do logging for Colonet
5
 * 
6
 * @author Jason Knichel
4 7
 *
5 8
 */
6 9

  
......
10 13

  
11 14
#include "includes/Logging.h"
12 15

  
16
/**
17
 * @brief Constructor for the Log class
18
 *
19
 * @param filename The name of the file to output log statements to
20
 */
13 21
Log::Log(char * filename) {
14 22
  printf("Creating log object\n");
15 23

  
......
28 36
  logMessage(LOG_TYPE_START_LOG, "Starting server");
29 37
}
30 38

  
31
Log::~Log()
32
{
39
/**
40
 * @brief Destructor for the Log class
41
 */
42
Log::~Log() {
33 43
  if (!logFile)
34 44
    fclose(logFile);
35 45
}
36 46

  
37
struct tm Log::getCurrentTime()
38
{
47
/**
48
 * @brief A function to get the current time
49
 *
50
 * @return A struct tm that represents the current time
51
 */
52
struct tm Log::getCurrentTime() {
39 53
  struct tm currTime;
40 54
  memset(&currTime, 0, sizeof(struct tm));
41 55
  
......
45 59
  return currTime;  
46 60
}
47 61

  
48
int Log::logMessage(int type, char * message)
49
{
62
/**
63
 * @brief This method logs a message with the specified type
64
 *
65
 * @param type The type of the message to log
66
 * @param message The message to log
67
 *
68
 * @return 0 on success, negative error code on error
69
 */
70
int Log::logMessage(int type, char * message) {
50 71
  if (!logFile) {
51 72
    fprintf(stderr, "Tried to log a message but the file pointer was null.\n");
52 73
    return -1;

Also available in: Unified diff