aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/common/feeddebugger.h
blob: 52b90930bfbd1a5e11ca37344dd02c5ae11b5a0b (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
31
32
33
34
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/document/base/documentid.h>
#include <vespa/log/log.h>
#include <vector>

namespace proton {

class FeedDebugger
{
public:
    FeedDebugger();
    ~FeedDebugger();
    bool isDebugging() const { return _enableDebugging; }
    ns_log::Logger::LogLevel getDebugLevel(uint32_t lid, const document::DocumentId & docid) const {
        return getDebugLevel(lid, & docid);
    }
    ns_log::Logger::LogLevel getDebugLevel(uint32_t lid, const document::DocumentId * docid) const {
        if (isDebugging()) {
            return getDebugDebuggerInternal(lid, docid);
        }
        return ns_log::Logger::spam;
    }
private:
    ns_log::Logger::LogLevel getDebugDebuggerInternal(uint32_t lid, const document::DocumentId * docid) const;
    bool                              _enableDebugging;
    std::vector<uint32_t>             _debugLidList; // List of lids to dump when feeding/replaying log.
    std::vector<document::DocumentId> _debugDocIdList; // List of docids("id:ns:doctype::xyz" to dump when feeding/replaying log.
};

} // namespace proton