File: PyPerfLoggingHelper.cc

package info (click to toggle)
bpfcc 0.18.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,368 kB
  • sloc: ansic: 132,727; python: 36,226; cpp: 26,973; sh: 710; yacc: 525; makefile: 141; lex: 94
file content (32 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (5)
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
/*
 * Copyright (c) Facebook, Inc.
 * Licensed under the Apache License, Version 2.0 (the "License")
 */

#include <cstdarg>
#include <cstdio>

#include "PyPerfLoggingHelper.h"

namespace ebpf {
namespace pyperf {

static uint64_t setVerbosityLevel = 0;

void setVerbosity(uint64_t verbosityLevel) {
  setVerbosityLevel = verbosityLevel;
}

void logInfo(uint64_t logLevel, const char* fmt, ...) {
  if (logLevel > setVerbosityLevel) {
    return;
  }

  va_list va;
  va_start(va, fmt);
  std::vfprintf(stderr, fmt, va);
  va_end(va);
}

}  // namespace pyperf
}  // namespace ebpf