Mark Geary.Logging log calls as printf-format, fix the resulting issues.

This commit is contained in:
Michael James Gratton 2017-12-18 13:55:39 +11:00
parent c371b91340
commit 6097b0a78f
4 changed files with 21 additions and 8 deletions

View file

@ -89,26 +89,31 @@ public inline bool are_all_flags_set(Flag flags) {
return logging_flags.is_all_set(flags);
}
[PrintfFormat]
public inline void error(Flag flags, string fmt, ...) {
if (logging_flags.is_any_set(flags))
logv(DOMAIN, LogLevelFlags.LEVEL_ERROR, fmt, va_list());
}
[PrintfFormat]
public inline void critical(Flag flags, string fmt, ...) {
if (logging_flags.is_any_set(flags))
logv(DOMAIN, LogLevelFlags.LEVEL_CRITICAL, fmt, va_list());
}
[PrintfFormat]
public inline void warning(Flag flags, string fmt, ...) {
if (logging_flags.is_any_set(flags))
logv(DOMAIN, LogLevelFlags.LEVEL_WARNING, fmt, va_list());
}
[PrintfFormat]
public inline void message(Flag flags, string fmt, ...) {
if (logging_flags.is_any_set(flags))
logv(DOMAIN, LogLevelFlags.LEVEL_MESSAGE, fmt, va_list());
}
[PrintfFormat]
public inline void debug(Flag flags, string fmt, ...) {
if (logging_flags.is_any_set(flags)) {
logv(DOMAIN, LogLevelFlags.LEVEL_DEBUG, fmt, va_list());

View file

@ -64,12 +64,16 @@ private class Geary.ImapEngine.ReplayQueue : Geary.BaseObject {
private Scheduler.Scheduled? notification_timer = null;
private int64 next_submission_number = 0;
private State state = State.OPEN;
public virtual signal void scheduled(ReplayOperation op) {
Logging.debug(Logging.Flag.REPLAY, "[%s] ReplayQueue::scheduled: %s %s", to_string(),
op.to_string());
Logging.debug(
Logging.Flag.REPLAY,
"[%s] ReplayQueue::scheduled: %s",
to_string(),
op.to_string()
);
}
public virtual signal void locally_executing(ReplayOperation op) {
Logging.debug(Logging.Flag.REPLAY, "[%s] ReplayQueue::locally-executing: %s", to_string(),
op.to_string());

View file

@ -484,7 +484,11 @@ public class Geary.Imap.Deserializer : BaseObject {
private void flush_params() {
bool okay = true;
if (this.context != this.root) {
Logging.debug(Logging.Flag.DESERIALIZER, "[%s] Unclosed list in parameters");
Logging.debug(
Logging.Flag.DESERIALIZER,
"[%s] Unclosed list in parameters",
to_string()
);
okay = false;
}

View file

@ -118,9 +118,9 @@ public class Geary.Smtp.ClientConnection {
Response response = yield transaction_async(new Request(Command.DATA), cancellable);
if (!response.code.is_start_data())
return response;
Logging.debug(Logging.Flag.NETWORK, "[%s] SMTP Data: <%ldb>", to_string(), data.size);
Logging.debug(Logging.Flag.NETWORK, "[%s] SMTP Data: <%z>", to_string(), data.size);
if (!already_dotstuffed) {
// By using DataStreamNewlineType.ANY, we're assured to get each line and convert to
// a proper line terminator for SMTP