Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
LoggingInterceptor.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Framework_WebServer_LoggingInterceptor_h_
5#define _Stroika_Framework_WebServer_LoggingInterceptor_h_ 1
6
7#include "Stroika/Frameworks/StroikaPreComp.h"
8
9#include "Interceptor.h"
10
11/*
12 *
13 * \note Code-Status: <a href="Code-Status.md#Alpha">Alpha</a>
14 *
15 * TODO:
16 * @todo Add W3CLogger handler.
17 *
18 */
19
21
22 using namespace Stroika::Foundation;
23
24 /**
25 * @todo add simple utility class that writes W3C log format to file.
26 */
27 struct ILogHandler {
28 struct MessageInstance {
29 MessageInstance (Message& m, Time::TimePointSeconds startedAt);
30 Message& fMessage;
31 Time::TimePointSeconds fStartedAt{};
32 };
33 virtual shared_ptr<MessageInstance> Started (Message& m);
34 virtual void Completed (const shared_ptr<MessageInstance>& messageInstance) noexcept = 0;
35 };
36
37 /**
38 */
39 class LoggingInterceptor : public Interceptor {
40 private:
41 using inherited = Interceptor;
42
43 public:
44 /**
45 * @todo consider if we should allow a list of loggers to be associated with the interceptor.
46 */
47 LoggingInterceptor (const shared_ptr<ILogHandler>& logger);
48
49 private:
50 struct Rep_;
51 };
52
53}
54
55/*
56 ********************************************************************************
57 ***************************** Implementation Details ***************************
58 ********************************************************************************
59 */
60#include "LoggingInterceptor.inl"
61
62#endif /*_Stroika_Framework_WebServer_LoggingInterceptor_h_*/
time_point< RealtimeClock, DurationSeconds > TimePointSeconds
TimePointSeconds is a simpler approach to chrono::time_point, which doesn't require using templates e...
Definition Realtime.h:82