-
Notifications
You must be signed in to change notification settings - Fork 10
/
LoggingInterceptor.h
62 lines (50 loc) · 1.7 KB
/
LoggingInterceptor.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Copyright(c) Sophist Solutions, Inc. 1990-2022. All rights reserved
*/
#ifndef _Stroika_Framework_WebServer_LoggingInterceptor_h_
#define _Stroika_Framework_WebServer_LoggingInterceptor_h_ 1
#include "../StroikaPreComp.h"
#include "Interceptor.h"
/*
*
* \version <a href="Code-Status.md#Alpha-Early">Alpha-Early</a>
*
* TODO:
* @todo Add W3CLogger handler.
*
*/
namespace Stroika::Frameworks::WebServer {
using namespace Stroika::Foundation;
/**
* @todo add simple utility class that writes W3C log format to file.
*/
struct ILogHandler {
struct MessageInstance {
MessageInstance (Message* m, Time::DurationSecondsType startedAt);
Message* fMessage{};
Time::DurationSecondsType fStartedAt{};
};
virtual shared_ptr<MessageInstance> Started (Message* m);
virtual void Completed (const shared_ptr<MessageInstance>& messageInstance) noexcept = 0;
};
/**
*/
class LoggingInterceptor : public Interceptor {
private:
using inherited = Interceptor;
public:
/**
* @todo consider if we should allow a list of loggers to be associated with the interceptor.
*/
LoggingInterceptor (const shared_ptr<ILogHandler>& logger);
private:
struct Rep_;
};
}
/*
********************************************************************************
***************************** Implementation Details ***************************
********************************************************************************
*/
#include "LoggingInterceptor.inl"
#endif /*_Stroika_Framework_WebServer_LoggingInterceptor_h_*/