1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9#pragma once
10
11#include <string>
12
13// Stages in libkineto used when pushing logs to UST Logger.
14constexpr char kWarmUpStage[] = "Warm Up";
15constexpr char kCollectionStage[] = "Collection";
16constexpr char kPostProcessingStage[] = "Post Processing";
17
18#if !USE_GOOGLE_LOG
19
20#include <map>
21#include <vector>
22
23namespace libkineto {
24
25enum LoggerOutputType {
26 VERBOSE = 0,
27 INFO = 1,
28 WARNING = 2,
29 ERROR = 3,
30 STAGE = 4,
31 ENUM_COUNT = 5
32};
33
34const char* toString(LoggerOutputType t);
35LoggerOutputType toLoggerOutputType(const std::string& str);
36
37constexpr int LoggerTypeCount = (int) LoggerOutputType::ENUM_COUNT;
38
39class ILoggerObserver {
40 public:
41 virtual ~ILoggerObserver() = default;
42 virtual void write(const std::string& message, LoggerOutputType ot) = 0;
43 virtual const std::map<LoggerOutputType, std::vector<std::string>> extractCollectorMetadata() = 0;
44 virtual void reset() = 0;
45 virtual void addDevice(const int64_t device) = 0;
46 virtual void setTraceDurationMS(const int64_t duration) = 0;
47 virtual void addEventCount(const int64_t count) = 0;
48 virtual void setTraceID(const std::string&) {}
49 virtual void setGroupTraceID(const std::string&) {}
50 virtual void addDestination(const std::string& dest) = 0;
51 virtual void setTriggerOnDemand() {}
52 virtual void addMetadata(const std::string& key, const std::string& value) = 0;
53
54};
55
56} // namespace libkineto
57
58#endif // !USE_GOOGLE_LOG
59