mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine the startup logs.
This commit is contained in:
parent
3ab0ccaa27
commit
f187a7deef
10 changed files with 273 additions and 243 deletions
|
@ -44,7 +44,13 @@ int SrsKafkaProducer::initialize()
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
srs_trace("initialize kafka producer ok.");
|
||||
// when kafka enabled, request metadata when startup.
|
||||
if (_srs_config->get_kafka_enabled() && (ret = request_metadata()) != ERROR_SUCCESS) {
|
||||
srs_error("request kafka metadata failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
srs_info("initialize kafka producer ok.");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -58,7 +64,7 @@ int SrsKafkaProducer::start()
|
|||
return ret;
|
||||
}
|
||||
|
||||
srs_trace("start kafka async worker ok.");
|
||||
srs_trace("kafka worker ok, enabled:%d", _srs_config->get_kafka_enabled());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -68,5 +74,14 @@ void SrsKafkaProducer::stop()
|
|||
worker->stop();
|
||||
}
|
||||
|
||||
int SrsKafkaProducer::request_metadata()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
srs_info("update kafka metadata ok");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
virtual int initialize();
|
||||
virtual int start();
|
||||
virtual void stop();
|
||||
private:
|
||||
virtual int request_metadata();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -440,7 +440,8 @@ int SrsSignalManager::start()
|
|||
sa.sa_flags = 0;
|
||||
sigaction(SRS_SIGNAL_PERSISTENCE_CONFIG, &sa, NULL);
|
||||
|
||||
srs_trace("signal installed");
|
||||
srs_trace("signal installed, reload=%d, dispose=%d, persistence=%d, grace_quit=%d",
|
||||
SRS_SIGNAL_RELOAD, SRS_SIGNAL_DISPOSE, SRS_SIGNAL_PERSISTENCE_CONFIG, SRS_SIGNAL_GRACEFULLY_QUIT);
|
||||
|
||||
return pthread->start();
|
||||
}
|
||||
|
|
|
@ -443,7 +443,7 @@ int srs_st_init()
|
|||
srs_error("st_set_eventsys use %s failed. ret=%d", st_get_eventsys_name(), ret);
|
||||
return ret;
|
||||
}
|
||||
srs_trace("st_set_eventsys to %s", st_get_eventsys_name());
|
||||
srs_info("st_set_eventsys to %s", st_get_eventsys_name());
|
||||
|
||||
if(st_init() != 0){
|
||||
ret = ERROR_ST_INITIALIZE;
|
||||
|
|
|
@ -230,6 +230,10 @@ void srs_parse_endpoint(string ip_port, string& ip, int& port)
|
|||
port = ::atoi(the_port.c_str());
|
||||
}
|
||||
|
||||
string srs_bool2switch(bool v) {
|
||||
return v? "on" : "off";
|
||||
}
|
||||
|
||||
int srs_kill_forced(int& pid)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
@ -490,7 +494,7 @@ void srs_update_proc_stat()
|
|||
static int user_hz = 0;
|
||||
if (user_hz <= 0) {
|
||||
user_hz = (int)sysconf(_SC_CLK_TCK);
|
||||
srs_trace("USER_HZ=%d", user_hz);
|
||||
srs_info("USER_HZ=%d", user_hz);
|
||||
srs_assert(user_hz > 0);
|
||||
}
|
||||
|
||||
|
@ -1234,6 +1238,12 @@ void retrieve_local_ipv4_ips()
|
|||
return;
|
||||
}
|
||||
|
||||
stringstream ss0;
|
||||
ss0 << "ips";
|
||||
|
||||
stringstream ss1;
|
||||
ss1 << "devices";
|
||||
|
||||
ifaddrs* p = ifap;
|
||||
while (p != NULL) {
|
||||
ifaddrs* cur = p;
|
||||
|
@ -1257,20 +1267,23 @@ void retrieve_local_ipv4_ips()
|
|||
|
||||
std::string ip = buf;
|
||||
if (ip != SRS_CONSTS_LOCALHOST) {
|
||||
srs_trace("retrieve local ipv4 ip=%s, index=%d", ip.c_str(), (int)ips.size());
|
||||
ss0 << ", local[" << (int)ips.size() << "] ipv4 " << ip;
|
||||
ips.push_back(ip);
|
||||
}
|
||||
|
||||
// set the device internet status.
|
||||
if (!srs_net_device_is_internet(inaddr->s_addr)) {
|
||||
srs_trace("detect intranet address: %s, ifname=%s", ip.c_str(), cur->ifa_name);
|
||||
ss1 << ", intranet ";
|
||||
_srs_device_ifs[cur->ifa_name] = false;
|
||||
} else {
|
||||
srs_trace("detect internet address: %s, ifname=%s", ip.c_str(), cur->ifa_name);
|
||||
ss1 << ", internet ";
|
||||
_srs_device_ifs[cur->ifa_name] = true;
|
||||
}
|
||||
ss1 << cur->ifa_name << " " << ip;
|
||||
}
|
||||
}
|
||||
srs_trace(ss0.str().c_str());
|
||||
srs_trace(ss1.str().c_str());
|
||||
|
||||
freeifaddrs(ifap);
|
||||
}
|
||||
|
|
|
@ -82,6 +82,11 @@ extern std::string srs_path_build_timestamp(std::string template_path);
|
|||
extern void srs_parse_endpoint(std::string ip_port, std::string& ip, std::string& port);
|
||||
extern void srs_parse_endpoint(std::string ip_port, std::string& ip, int& port);
|
||||
|
||||
/**
|
||||
* convert bool to switch value, true to "on", false to "off".
|
||||
*/
|
||||
extern std::string srs_bool2switch(bool v);
|
||||
|
||||
/**
|
||||
* kill the pid by SIGINT, then wait to quit,
|
||||
* kill the pid by SIGKILL again when exceed the timeout.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue