summaryrefslogtreecommitdiff
path: root/source/utilities/Logger.h
blob: ec1f0a940cdc155309da29d0ba36853d44f38873 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*******************************************************************************
 * Copyright (C) ST-Ericsson SA 2011
 * License terms: 3-clause BSD license
 ******************************************************************************/

#ifndef _LOGGER_H_
#define _LOGGER_H_

#include "t_basicdefinitions.h"
#ifdef _WIN32
#include "WinApiWrappers.h"
#else
#include "LinuxApiWrappers.h"
#endif

typedef void (*MessageCallback_t)(const void *Communication_p, uint32 MessageLength, const char *MessageText);

class Logger
{
public:
    Logger(const void *communication);

    void log(const char *format, ...);
    void setMessageCallback(MessageCallback_t messageCallback) {
        messageCallback_ = messageCallback;
    }
private:
    CCriticalSectionObject criticalSection_;
    const void *communication_;
    MessageCallback_t messageCallback_;
};

#endif // _LOGGER_H_