提交 d0a845b3 编写于 作者: baowanyu's avatar baowanyu 提交者: GoLancer

framework: remove LOG_XXX_FORMAT marco in log.h

上级 c6f85477
......@@ -122,53 +122,4 @@
return val; \
}
#define LOG_DEBUG_FORMAT(args...) ALOG_MODULE_INFO(MODULE_NAME, ##args)
#define LOG_INFO_FORMAT(args...) ALOG_MODULE_INFO(MODULE_NAME, ##args)
#define LOG_WARN_FORMAT(args...) ALOG_MODULE_WARN(MODULE_NAME, ##args)
#define LOG_ERROR_FORMAT(args...) ALOG_MODULE_ERROR(MODULE_NAME, ##args)
#define LOG_FATAL_FORMAT(args...) ALOG_MODULE_ERROR(MODULE_NAME, ##args)
#ifndef ALOG_MODULE_INFO
#define ALOG_MODULE_INFO(module, fmt, args...) \
do { \
::apollo::cybertron::common::WriteLog(module, google::INFO, __FILE__, \
__LINE__, fmt, ##args); \
} while (0)
#endif
#ifndef ALOG_MODULE_WARN
#define ALOG_MODULE_WARN(module, fmt, args...) \
do { \
::apollo::cybertron::common::WriteLog(module, google::WARNING, __FILE__, \
__LINE__, fmt, ##args); \
} while (0)
#endif
#ifndef ALOG_MODULE_ERROR
#define ALOG_MODULE_ERROR(module, fmt, args...) \
do { \
::apollo::cybertron::common::WriteLog(module, google::ERROR, __FILE__, \
__LINE__, fmt, ##args); \
} while (0)
#endif
namespace apollo {
namespace cybertron {
namespace common {
static void WriteLog(const char* module, google::LogSeverity severity,
const char* file, int line, const char* fmt, ...) {
char fmt_buffer[9000];
va_list arg_ptr;
va_start(arg_ptr, fmt);
vsnprintf(fmt_buffer, sizeof(fmt_buffer), fmt, arg_ptr);
va_end(arg_ptr);
google::LogMessage(file, line, severity).stream()
<< LEFT_BRACKET << module << RIGHT_BRACKET << fmt_buffer;
}
} // namespace common
} // namespace cybertron
} // namespace apollo
#endif // CYBERTRON_COMMON_LOG_H_
......@@ -8,7 +8,6 @@ namespace common {
TEST(LogTest, TestAll) {
AINFO << "11111";
LOG_INFO_FORMAT("%d", 123456);
}
} // namespace logger
......
......@@ -43,9 +43,9 @@ void VelodyneDriver::set_base_time_from_nmea_time(NMEATimePtr nmea_time,
// set last gps time using gps socket packet
last_gps_time_ = (nmea_time->min * 60 + nmea_time->sec) * 1e6;
LOG_INFO_FORMAT("Set base unix time : %d-%d-%d %d:%d:%d", time.tm_year,
time.tm_mon, time.tm_mday, time.tm_hour, time.tm_min,
time.tm_sec);
AINFO << "Set base unix time : " << time.tm_year << "-" << time.tm_mon << "-"
<< time.tm_mday << " " << time.tm_hour << ":" << time.tm_min << ":"
<< time.tm_sec;
uint64_t unix_base = static_cast<uint64_t>(timegm(&time));
*basetime = unix_base * 1e6;
}
......
......@@ -64,11 +64,10 @@ bool Input::exract_nmea_time_from_packet(NMEATimePtr nmea_time,
nmea_time->mon < 1 || nmea_time->day > 31 || nmea_time->day < 1 ||
nmea_time->hour > 23 || nmea_time->hour < 0 || nmea_time->min > 59 ||
nmea_time->min < 0 || nmea_time->sec > 59 || nmea_time->sec < 0) {
LOG_ERROR_FORMAT(
"Invalid GPS time: %d-%d-%d %d:%d:%d, make sure have connected to GPS "
"device",
nmea_time->year, nmea_time->mon, nmea_time->day, nmea_time->hour,
nmea_time->min, nmea_time->sec);
AERROR << "Invalid GPS time: " << nmea_time->year << "-" << nmea_time->mon
<< "-" << nmea_time->day << " " << nmea_time->hour << ":"
<< nmea_time->min << ":" << nmea_time->sec
<< ", make sure have connected to GPS device";
return false;
}
return true;
......
......@@ -87,8 +87,8 @@ void Velodyne64Parser::set_base_time_from_packets(const VelodynePacket& pkt) {
break;
}
LOG_INFO_FORMAT("Get base time from packets. Obtained (%d.%d.%d %d:%d:%d)",
year, month, day, hour, minute, second);
AINFO << "Get base time from packets. Obtained (" << year << "." << month
<< "." << day << " " << hour << ":" << minute << ":" << second;
if (status_type == GPS_STATUS && year > 0 && month > 0 && day > 0 &&
hour >= 0 && minute >= 0 && second >= 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册