af_core_macros/logger.rs
1// Copyright © 2020 Alexandra Frydl
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7/// Initializes `af_runtime::logger`.
8#[macro_export]
9macro_rules! logger_init {
10 () => {
11 af_core::log::init();
12
13 af_core::log::set_level_of(
14 option_env!("CARGO_BIN_NAME").unwrap_or(env!("CARGO_PKG_NAME")).replace("-", "_"),
15 match cfg!(debug_assertions) {
16 true => af_core::log::Debug,
17 false => af_core::log::Info,
18 },
19 );
20 };
21}