| 205 | } |
| 206 | |
| 207 | fc::logging_config create_default_logging_config(const fc::path& data_dir, bool enable_ulog) { |
| 208 | fc::logging_config cfg; |
| 209 | fc::path log_dir("logs"); |
| 210 | fc::file_appender::config ac; |
| 211 | ac.filename = log_dir / "default" / "default.log"; |
| 212 | ac.flush = true; |
| 213 | ac.rotate = true; |
| 214 | ac.rotation_interval = fc::hours(1); |
| 215 | ac.rotation_limit = fc::days(1); |
| 216 | // ac.rotation_compression = false; |
| 217 | std::cout << "Logging to file: " << (data_dir / ac.filename).preferred_string() << "\n"; |
| 218 | fc::file_appender::config ac_rpc; |
| 219 | ac_rpc.filename = log_dir / "rpc" / "rpc.log"; |
| 220 | ac_rpc.flush = true; |
| 221 | ac_rpc.rotate = true; |
| 222 | ac_rpc.rotation_interval = fc::hours(1); |
| 223 | ac_rpc.rotation_limit = fc::days(1); |
| 224 | // ac_rpc.rotation_compression = false; |
| 225 | std::cout << "Logging RPC to file: " << (data_dir / ac_rpc.filename).preferred_string() << "\n"; |
| 226 | fc::file_appender::config ac_blockchain; |
| 227 | ac_blockchain.filename = log_dir / "blockchain" / "blockchain.log"; |
| 228 | ac_blockchain.flush = true; |
| 229 | ac_blockchain.rotate = true; |
| 230 | ac_blockchain.rotation_interval = fc::hours(1); |
| 231 | ac_blockchain.rotation_limit = fc::days(1); |
| 232 | // ac_blockchain.rotation_compression = false; |
| 233 | std::cout << "Logging blockchain to file: " << (data_dir / ac_blockchain.filename).preferred_string() << "\n"; |
| 234 | fc::file_appender::config ac_p2p; |
| 235 | ac_p2p.filename = log_dir / "p2p" / "p2p.log"; |
| 236 | #ifdef NDEBUG |
| 237 | ac_p2p.flush = false; |
| 238 | #else // NDEBUG |
| 239 | ac_p2p.flush = true; |
| 240 | #endif // NDEBUG |
| 241 | ac_p2p.rotate = true; |
| 242 | ac_p2p.rotation_interval = fc::hours(1); |
| 243 | ac_p2p.rotation_limit = fc::days(1); |
| 244 | // ac_p2p.rotation_compression = false; |
| 245 | std::cout << "Logging P2P to file: " << (data_dir / ac_p2p.filename).preferred_string() << "\n"; |
| 246 | fc::variants c{ |
| 247 | fc::mutable_variant_object("level", "debug")("color", "green"), |
| 248 | fc::mutable_variant_object("level", "warn")("color", "brown"), |
| 249 | fc::mutable_variant_object("level", "error")("color", "red") }; |
| 250 | cfg.appenders.push_back( |
| 251 | fc::appender_config("stderr", "console", |
| 252 | fc::mutable_variant_object() |
| 253 | ("stream", "std_error") |
| 254 | ("level_colors", c) |
| 255 | )); |
| 256 | cfg.appenders.push_back(fc::appender_config("default", "file", fc::variant(ac))); |
| 257 | cfg.appenders.push_back(fc::appender_config("rpc", "file", fc::variant(ac_rpc))); |
| 258 | cfg.appenders.push_back(fc::appender_config("blockchain", "file", fc::variant(ac_blockchain))); |
| 259 | cfg.appenders.push_back(fc::appender_config("p2p", "file", fc::variant(ac_p2p))); |
| 260 | fc::logger_config dlc; |
| 261 | #ifdef ALP_TEST_NETWORK |
| 262 | dlc.level = fc::log_level::debug; |
| 263 | #else |
| 264 | dlc.level = fc::log_level::warn; |
no test coverage detected