aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/util/logutil.h
blob: 6afb654a960d20e4e978c53bd2497da489b1844c (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/util/jsonwriter.h>

namespace search::util {

class LogUtil {
public:
    /**
     * Extract the last num elements from the given path and
     * return a new path with these elements.
     **/
    static vespalib::string extractLastElements(const vespalib::string & path, size_t numElems);

    /**
     * Log the given directory (with size) to the given json stringer.
     *
     * @param jstr     the json stringer to log into.
     * @param path     the path of the directory to log.
     * @param numElems the last number of elements from the path to log.
     **/
    static void logDir(vespalib::JSONStringer & jstr, const vespalib::string & path, size_t numElems);
};

}