MiKTeX 23.10-next
A scalable TeX distribution
Loading...
Searching...
No Matches
TraceCallback.h
1/* miktex/Trace/TraceCallback.h: -*- C++ -*-
2
3 Copyright (C) 1996-2020 Christian Schenk
4
5 This file is part of the MiKTeX Trace Library.
6
7 The MiKTeX Trace Library is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2, or
10 (at your option) any later version.
11
12 The MiKTeX Trace Library is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with the MiKTeX Trace Library; if not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22#pragma once
23
24#if !defined(C603C4D3DC8B49F7BF8E691D3A08A925)
25#define C603C4D3DC8B49F7BF8E691D3A08A925
26
27#include "config.h"
28
29#include <ostream>
30#include <string>
31
32MIKTEX_TRACE_BEGIN_NAMESPACE;
33
34enum class TraceLevel
35{
36 Fatal,
37 Error,
38 Warning,
39 Info,
40 Trace,
41 Debug
42};
43
44class MIKTEXNOVTABLE TraceCallback
45{
46public:
48 {
49 TraceMessage(const std::string& streamName, const std::string& facility, TraceLevel level, const std::string& message) :
50 streamName(streamName),
51 facility(facility),
52 level(level),
53 message(message)
54 {
55 }
56 MIKTEXTRACETHISAPI(std::string) ToString() const;
57 std::string streamName;
58 std::string facility;
59 TraceLevel level;
60 std::string message;
61 };
62
63public:
64 virtual bool MIKTEXTHISCALL Trace(const TraceMessage& traceMessage) = 0;
65};
66
67inline std::ostream& operator<<(std::ostream& os, const TraceCallback::TraceMessage& traceMessage)
68{
69 return os << traceMessage.ToString();
70}
71
72MIKTEX_TRACE_END_NAMESPACE;
73
74#endif
Definition: TraceCallback.h:45
Definition: TraceCallback.h:48