File tree Expand file tree Collapse file tree 5 files changed +27
-2
lines changed
exonum-java-binding/core/rust Expand file tree Collapse file tree 5 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ exonum-configuration = "0.11"
13
13
exonum-btc-anchoring = " 0.11"
14
14
exonum-time = " 0.11"
15
15
env_logger = " 0.6.1"
16
+ log = " 0.4"
16
17
toml = " 0.4.6"
17
18
serde = " 1.0"
18
19
serde_derive = " 1.0"
Original file line number Diff line number Diff line change @@ -19,17 +19,39 @@ extern crate exonum_btc_anchoring;
19
19
extern crate exonum_configuration;
20
20
extern crate exonum_time;
21
21
extern crate java_bindings;
22
+ #[ macro_use]
23
+ extern crate log;
22
24
23
25
#[ cfg( test) ]
24
26
extern crate tempfile;
25
27
28
+ use java_bindings:: get_lib_version;
29
+
26
30
mod node_builder;
27
31
28
32
fn main ( ) {
29
33
env_logger:: init ( ) ;
30
34
// Panic if `_JAVA_OPTIONS` environmental variable is set.
31
35
java_bindings:: panic_if_java_options ( ) ;
32
36
37
+ // Log app's metadata
38
+ log_app_metadata ( ) ;
39
+
33
40
let builder = node_builder:: create ( ) ;
34
41
builder. run ( )
35
42
}
43
+
44
+ // Prints info about version and build mode of started app to the STDOUT.
45
+ fn log_app_metadata ( ) {
46
+ let version = get_lib_version ( ) ;
47
+ let build_type = if cfg ! ( debug_assertions) {
48
+ "debug"
49
+ } else {
50
+ "release"
51
+ } ;
52
+
53
+ info ! (
54
+ "Started Exonum Java {} (built in {} mode)" ,
55
+ version, build_type
56
+ ) ;
57
+ }
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ pub extern "system" fn Java_com_exonum_binding_util_LibraryLoader_nativeGetLibra
23
23
env. new_string ( get_lib_version ( ) ) . unwrap ( ) . into_inner ( )
24
24
}
25
25
26
- // Returns the exact value of the `version` field from the library's Cargo.toml configuration file.
27
- fn get_lib_version ( ) -> & ' static str {
26
+ /// Returns the exact value of the `version` field from the library's Cargo.toml configuration file.
27
+ pub fn get_lib_version ( ) -> & ' static str {
28
28
env ! ( "CARGO_PKG_VERSION" )
29
29
}
30
30
Original file line number Diff line number Diff line change @@ -25,5 +25,6 @@ mod time_service;
25
25
26
26
pub use self :: config:: * ;
27
27
pub use self :: java_service_runtime:: JavaServiceRuntime ;
28
+ pub use self :: library_loader:: get_lib_version;
28
29
pub use self :: paths:: panic_if_java_options;
29
30
pub use self :: service_factory_adapter:: JavaServiceFactoryAdapter ;
You can’t perform that action at this time.
0 commit comments