source->size - source->filled);
if (n < 0) {
if (errno != EAGAIN && errno != EWOULDBLOCK)
- log_error("read(%d, ..., %zd): %m", source->fd,
+ log_error_errno(errno, "read(%d, ..., %zd): %m", source->fd,
source->size - source->filled);
return -errno;
} else if (n == 0)
source->size - source->filled);
if (n < 0) {
if (errno != EAGAIN && errno != EWOULDBLOCK)
- log_error("read(%d, ..., %zd): %m", source->fd,
+ log_error_errno(errno, "read(%d, ..., %zd): %m", source->fd,
source->size - source->filled);
return -errno;
} else if (n == 0)
assert(line[n-1] == '\n');
if (n == 1) {
- log_debug("Received empty line, event is ready");
+ log_trace("Received empty line, event is ready");
return 1;
}
else
/* replace \n with = */
line[n-1] = '=';
- log_debug("Received: %.*s", (int) n, line);
+ log_trace("Received: %.*s", (int) n, line);
r = iovw_put(&source->iovw, line, n);
if (r < 0) {
assert(source->data_size == 0);
r = get_data_size(source);
- log_debug("get_data_size() -> %d", r);
+ // log_debug("get_data_size() -> %d", r);
if (r < 0)
return r;
if (r == 0) {
assert(source->data_size > 0);
r = get_data_data(source, &data);
- log_debug("get_data_data() -> %d", r);
+ // log_debug("get_data_data() -> %d", r);
if (r < 0)
return r;
if (r == 0) {
case STATE_DATA_FINISH:
r = get_data_newline(source);
- log_debug("get_data_newline() -> %d", r);
+ // log_debug("get_data_newline() -> %d", r);
if (r < 0)
return r;
if (r == 0) {
return r;
/* We have a full event */
- log_debug("Received a full event from source@%p fd:%d (%s)",
+ log_trace("Received a full event from source@%p fd:%d (%s)",
source, source->fd, source->name);
if (!source->iovw.count) {
r = writer_write(source->writer, &source->iovw, &source->ts, compress, seal);
if (r < 0)
- log_error("Failed to write entry of %zu bytes: %s",
- iovw_size(&source->iovw), strerror(-r));
+ log_error_errno(r, "Failed to write entry of %zu bytes: %m",
+ iovw_size(&source->iovw));
else
r = 1;
char *tmp;
tmp = realloc(source->buf, target);
- if (tmp)
+ if (!tmp)
log_warning("Failed to reallocate buffer to (smaller) size %zu",
target);
else {