本文整理汇总了C++中SLOG函数的典型用法代码示例。如果您正苦于以下问题:C++ SLOG函数的具体用法?C++ SLOG怎么用?C++ SLOG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SLOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: chdir_for_file
int chdir_for_file(char const *dir, bool is_filename)
{
char *redir;
if (is_filename) {
redir = tempstr_printf("%s", dir);
char *last_slash = redir;
for (char *c = redir; *c; c++) if (*c == '/') last_slash = c;
*last_slash = '\0';
} else {
redir = (char *)dir;
}
SLOG(LOG_DEBUG, "chdir into '%s'", redir);
if (redir[0] == '\0') return 0;
if (0 != chdir(redir)) {
SLOG(LOG_ERR, "Cannot chdir(%s) : %s", redir, strerror(errno));
return -1;
}
return 0;
}
示例2: tns_parse_login_property
static enum proto_parse_status tns_parse_login_property(struct sql_proto_info *info, struct cursor *cursor)
{
SLOG(LOG_DEBUG, "Parsing tns login property");
// We are only interested in response
if (info->is_query) return PROTO_OK;
if (info->msg_type != SQL_UNKNOWN && info->msg_type != SQL_STARTUP) return PROTO_PARSE_ERR;
// Drop Server version
DROP_FIX(cursor, 3);
// Drop Server version text
uint8_t marker = 0x00;
enum proto_parse_status status = cursor_drop_until(cursor, &marker, sizeof(marker));
if (status != PROTO_OK) return status;
// Drop Null byte
DROP_FIX(cursor, 1);
CHECK(2);
uint16_t charset = cursor_read_u16le(cursor);
SLOG(LOG_DEBUG, "Found a charset of 0x%02x", charset);
switch (charset) {
case 0x01:
case 0x02:
case 0x1f:
case 0xb2:
sql_set_encoding(info, SQL_ENCODING_LATIN1);
break;
case 0x366:
case 0x367:
case 0x369:
sql_set_encoding(info, SQL_ENCODING_UTF8);
break;
default:
SLOG(LOG_DEBUG, "Unknown charset");
break;
}
// We don't care of the rest...
cursor_drop(cursor, cursor->cap_len);
return PROTO_OK;
}
示例3: get_gid
static gid_t get_gid(const char * const group)
{
assert(group);
gid_t gid = getgid(); // default one
struct group *g = getgrnam(group);
if (NULL == g)
SLOG(LOG_ERR, "getgrnam: can't get the uid of '%s'", group);
else
gid = g->gr_gid;
return gid;
}
示例4: netbios_parser_ctor
static int netbios_parser_ctor(struct netbios_parser *netbios_parser, struct proto *proto)
{
SLOG(LOG_DEBUG, "Constructing [email protected]%p", netbios_parser);
assert(proto == proto_netbios);
if (0 != parser_ctor(&netbios_parser->parser, proto)) return -1;
netbios_parser->msg_parser = NULL;
timeval_reset(&netbios_parser->first_packet_tv[0]);
timeval_reset(&netbios_parser->first_packet_tv[1]);
if (0 != streambuf_ctor(&netbios_parser->sbuf, netbios_sbuf_parse, 30000, NULL)) {
parser_dtor(&netbios_parser->parser);
return -1;
}
return 0;
}
示例5: file_size
ssize_t file_size(char const *file_name)
{
int fd = file_open(file_name, O_RDONLY);
if (fd < 0) return -1;
off_t sz = lseek(fd, 0, SEEK_END);
if (sz == (off_t)-1) {
SLOG(LOG_ERR, "Cannot lseek at end of '%s' : %s", file_name, strerror(errno));
return -1;
}
file_close(fd);
return sz;
}
示例6: rtp_parse
static enum proto_parse_status rtp_parse(struct parser *parser, struct proto_layer *parent, unsigned way, uint8_t const *packet, size_t cap_len, size_t wire_len, struct timeval const *now, proto_okfn_t *okfn)
{
SLOG(LOG_DEBUG, "Starting RTP analysis");
/* Parse */
struct rtp_header *rtph = (struct rtp_header *)packet;
if (wire_len < sizeof(*rtph)) return PROTO_PARSE_ERR;
if (cap_len < sizeof(*rtph)) return PROTO_TOO_SHORT;
SLOG(LOG_DEBUG, "RTP header, version=%u, CSRC_count=%u, payload_type=%u",
rtph->version, rtph->csrc_count, rtph->payload_type);
size_t head_len = sizeof(*rtph) + rtph->csrc_count * 4;
if (wire_len < head_len) return PROTO_PARSE_ERR;
if (cap_len < head_len) return PROTO_TOO_SHORT;
struct rtp_proto_info info;
rtp_proto_info_ctor(&info, rtph, head_len, wire_len - head_len);
struct proto_layer layer;
proto_layer_ctor(&layer, parent, parser, &info.info);
return proto_parse(NULL, &layer, way, NULL, 0, 0, now, okfn);
}
示例7: log_x25_facilities
static int
log_x25_facilities (int fd, int coc, char *caption)
{
FACILITY_DB f;
if (ioctl (fd, X25_RD_FACILITY, (char *) &f) == NOTOK) {
SLOG (compat_log, LLOG_EXCEPTIONS, "failed", ("X25_RD_FACILITY"));
return NOTOK;
}
print_x25_facilities (f, coc, caption);
return OK;
}
示例8: on_unload
void on_unload(void)
{
SLOG(LOG_INFO, "Duplicogram unloading");
term_fini();
hook_subscriber_dtor(&dup_hook, &dup_subscription);
hook_subscriber_dtor(&proto_cap->hook, &cap_subscription);
cli_unregister(duplicogram_opts);
//mutex_dtor(&dup_lock); no since we can have some callbacks called even after we unsubscribed (in another thread)
ext_param_bucket_width_fini();
log_category_duplicogram_fini();
}
示例9: ip_addr_ctor_from_str_any
int ip_addr_ctor_from_str_any(struct ip_addr *ip, char const *str)
{
if (1 == inet_pton(AF_INET, str, &ip->u.v4)) {
ip->family = AF_INET;
return 0;
}
if (1 == inet_pton(AF_INET6, str, &ip->u.v6)) {
ip->family = AF_INET6;
return 0;
}
SLOG(LOG_WARNING, "Cannot convert string to IP address: %s", strerror(errno));
return -1;
}
示例10: _snprintf_s
/* CRelationMgr::Insert()和CRelationMgr::Remove()时调用,
用于添加网关上下线记录。
*/
bool CClientInfo::AddOnoffRecord(const char * name, char * add, int onoff)
{
char sql_line_exist[NORMAL_XG_BUF_LEN];
int sql_len_exist = _snprintf_s(sql_line_exist, NORMAL_XG_BUF_LEN-1, _TRUNCATE,
"SELECT COUNT(*) FROM %s WHERE serial='%s'", m_onoff_record_table, name);
sql_line_exist[sql_len_exist] = '\0';
SLOG(4)("AddOnoffRecord = %s", sql_line_exist);
MYSQL_RES * existresults = BeginQuery(sql_line_exist);
if (NULL == existresults)
{
return FALSE;
}
int recordnum = strtoul(*mysql_fetch_row(existresults), NULL, 0);
EndQuery(existresults);
if( recordnum == 120) // 如果已有的该网关上下线记录等于120条
{
SLOG(4)("此处应当删除前21条记录");
DelOnoffRecord(name);
}
InsertOnoffRecord(name, add, onoff);
return TRUE;
}
示例11: rtp_parse
static enum proto_parse_status rtp_parse(struct parser *parser, struct proto_info *parent, unsigned way, uint8_t const *packet, size_t cap_len, size_t wire_len, struct timeval const *now, size_t tot_cap_len, uint8_t const *tot_packet)
{
SLOG(LOG_DEBUG, "Starting RTP analysis");
/* Parse */
struct rtp_hdr *rtph = (struct rtp_hdr *)packet;
if (wire_len < sizeof(*rtph)) return PROTO_PARSE_ERR;
if (cap_len < sizeof(*rtph)) return PROTO_TOO_SHORT;
unsigned const version = READ_U8(&rtph->flags0) >> 6U;
unsigned const csrc_count = READ_U8(&rtph->flags0) & F0_CSRC_COUNT_MASK;
unsigned const payload_type = READ_U8(&rtph->flags1) & F1_PLD_TYPE_MASK;
SLOG(LOG_DEBUG, "RTP header, version=%u, CSRC_count=%u, payload_type=%u", version, csrc_count, payload_type);
size_t head_len = sizeof(*rtph) + csrc_count * 4;
if (wire_len < head_len) return PROTO_PARSE_ERR;
if (cap_len < head_len) return PROTO_TOO_SHORT;
struct rtp_proto_info info;
rtp_proto_info_ctor(&info, parser, parent, rtph, head_len, wire_len - head_len);
return proto_parse(NULL, &info.info, way, NULL, 0, 0, now, tot_cap_len, tot_packet);
}
示例12: ftw_copy_link
static int ftw_copy_link(const struct FTW *p,
const char *spath,
const struct stat *sstp,
int exists)
{
int len;
char llink[PATH_MAX];
if ((len = readlink(spath, llink, sizeof(llink) - 1)) == -1) {
SLOG("readlink: %s: %s", spath, strerror(errno));
return (1);
}
llink[len] = '\0';
if (exists && unlink(to.p_path)) {
SLOG("unlink: %s: %s", to.p_path, strerror(errno));
return (1);
}
if (symlink(llink, to.p_path)) {
SLOG("symlink: %s: %s", llink, strerror(errno));
return (1);
}
return (pflag ? setfile(sstp, -1) : 0);
}
示例13: __tts_notify_utt_completed
static Eina_Bool __tts_notify_utt_completed(void *data)
{
tts_h tts = (tts_h)data;
tts_client_s* client = tts_client_get(tts);
/* check handle */
if (NULL == client) {
SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Fail to notify utt completed : A handle is not valid");
return EINA_FALSE;
}
if (NULL != client->utt_completeted_cb) {
SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of utterance completed \n");
tts_client_use_callback(client);
client->utt_completeted_cb(client->tts, client->utt_id, client->utt_completed_user_data);
tts_client_not_use_callback(client);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of utterance completed \n");
}
return EINA_FALSE;
}
示例14: __tts_notify_state_changed
static Eina_Bool __tts_notify_state_changed(void *data)
{
tts_h tts = (tts_h)data;
tts_client_s* client = tts_client_get(tts);
/* check handle */
if (NULL == client) {
SLOG(LOG_WARN, TAG_TTSC, "Fail to notify error : A handle is not valid");
return EINA_FALSE;
}
if (NULL != client->state_changed_cb) {
tts_client_use_callback(client);
client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data);
tts_client_not_use_callback(client);
SLOG(LOG_DEBUG, TAG_TTSC, "State changed callback is called");
} else {
SLOG(LOG_WARN, TAG_TTSC, "[WARNING] State changed callback is null");
}
return EINA_FALSE;
}
示例15: __tts_notify_error
static Eina_Bool __tts_notify_error(void *data)
{
tts_h tts = (tts_h)data;
tts_client_s* client = tts_client_get(tts);
/* check handle */
if (NULL == client) {
SLOG(LOG_WARN, TAG_TTSC, "Fail to notify error : A handle is not valid");
return EINA_FALSE;
}
if (NULL != client->error_cb) {
SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of error");
tts_client_use_callback(client);
client->error_cb(client->tts, client->utt_id, client->reason, client->error_user_data );
tts_client_not_use_callback(client);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error \n");
}
return EINA_FALSE;
}