aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/sessions/inprocsessionlogsink.h
blob: 15f9b5ec321560c96758de706f34b41cb5b50451 (plain) (blame)
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
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "sessions.h"

#include <zencore/logging/sink.h>
#include <zencore/session.h>

#include <mutex>

namespace zen {

/// Log sink that forwards log messages to the server's own session
/// in the SessionsService, making them visible in the sessions browser UI.
class InProcSessionLogSink : public logging::Sink
{
public:
	explicit InProcSessionLogSink(SessionsService& Service) : m_Service(Service), m_SessionId(GetSessionId()) {}

	void Log(const logging::LogMessage& Msg) override;
	void Flush() override {}
	void SetFormatter(std::unique_ptr<logging::Formatter> /*InFormatter*/) override {}

private:
	SessionsService& m_Service;
	Oid				 m_SessionId;
};

}  // namespace zen