Skip to content

Commit 74b321b

Browse files
committed
make_log_settings from common.cpp
1 parent dec1258 commit 74b321b

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

silkworm/capi/log_level.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2025 The Silkworm Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
#ifndef SILKWORM_CAPI_LOG_LEVEL_H_
5+
#define SILKWORM_CAPI_LOG_LEVEL_H_
6+
7+
#if __cplusplus
8+
extern "C" {
9+
#endif
10+
11+
//! Silkworm library logging level
12+
//! \note using anonymous C99 enum is the most portable way to pass enum in Cgo
13+
typedef enum { // NOLINT(performance-enum-size)
14+
SILKWORM_LOG_NONE,
15+
SILKWORM_LOG_CRITICAL,
16+
SILKWORM_LOG_ERROR,
17+
SILKWORM_LOG_WARNING,
18+
SILKWORM_LOG_INFO,
19+
SILKWORM_LOG_DEBUG,
20+
SILKWORM_LOG_TRACE
21+
} SilkwormLogLevel;
22+
23+
#if __cplusplus
24+
}
25+
#endif
26+
27+
#endif // SILKWORM_CAPI_LOG_LEVEL_H_
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 The Silkworm Authors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
#include "common.hpp"
4+
#include "make_log_settings.hpp"
55

66
#include <cstring>
77

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33

44
#pragma once
55

6-
#include <filesystem>
7-
86
#include <silkworm/infra/common/log.hpp>
97

10-
#include "silkworm.h"
8+
#include "log_level.h"
119

1210
//! Build log configuration matching Erigon log format w/ custom verbosity level
1311
silkworm::log::Settings make_log_settings(SilkwormLogLevel c_log_level);

silkworm/capi/silkworm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
#include <silkworm/rpc/ethbackend/remote_backend.hpp>
4545
#include <silkworm/rpc/ethdb/kv/backend_providers.hpp>
4646

47-
#include "common.hpp"
4847
#include "common/parse_path.hpp"
4948
#include "instance.hpp"
49+
#include "make_log_settings.hpp"
5050

5151
using namespace std::chrono_literals;
5252
using namespace silkworm;

silkworm/capi/silkworm.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,14 @@
1717
#include "rpcdaemon.h"
1818
#include "sentry.h"
1919
#endif
20+
#include "log_level.h"
2021

2122
#if __cplusplus
2223
extern "C" {
2324
#endif
2425

2526
#define SILKWORM_GIT_VERSION_SIZE 32
2627

27-
//! Silkworm library logging level
28-
//! \note using anonymous C99 enum is the most portable way to pass enum in Cgo
29-
typedef enum { // NOLINT(performance-enum-size)
30-
SILKWORM_LOG_NONE,
31-
SILKWORM_LOG_CRITICAL,
32-
SILKWORM_LOG_ERROR,
33-
SILKWORM_LOG_WARNING,
34-
SILKWORM_LOG_INFO,
35-
SILKWORM_LOG_DEBUG,
36-
SILKWORM_LOG_TRACE
37-
} SilkwormLogLevel;
38-
3928
//! Silkworm library general configuration options
4029
struct SilkwormSettings {
4130
//! Log verbosity level

0 commit comments

Comments
 (0)