Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Color Profile Background Color not being used. #68

Merged
merged 1 commit into from

2 participants

@tobegit

The Background Color from the Color Profile was not being used when
logging. bgCode added to iovec in DDTTYLogger.

Toby Background Color from Color Profile not being used
The Background Color from the Color Profile was not being used when
logging. bgCode added to iovec in DDTTYLogger.
399bb03
@robbiehanson robbiehanson merged commit 6c978fd into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 24, 2012
  1. Background Color from Color Profile not being used

    Toby authored
    The Background Color from the Color Profile was not being used when
    logging. bgCode added to iovec in DDTTYLogger.
This page is out of date. Refresh to see the latest.
Showing with 51 additions and 39 deletions.
  1. +51 −39 Lumberjack/DDTTYLogger.m
View
90 Lumberjack/DDTTYLogger.m
@@ -1215,32 +1215,38 @@ - (void)logMessage:(DDLogMessage *)logMessage
{
// The log message has already been formatted.
- struct iovec v[4];
+ struct iovec v[5];
if (colorProfile)
{
v[0].iov_base = colorProfile->fgCode;
v[0].iov_len = colorProfile->fgCodeLen;
-
- v[3].iov_base = colorProfile->resetCode;
- v[3].iov_len = colorProfile->resetCodeLen;
+
+ v[1].iov_base = colorProfile->bgCode;
+ v[1].iov_len = colorProfile->bgCodeLen;
+
+ v[4].iov_base = colorProfile->resetCode;
+ v[4].iov_len = colorProfile->resetCodeLen;
}
else
{
v[0].iov_base = "";
v[0].iov_len = 0;
- v[3].iov_base = "";
- v[3].iov_len = 0;
+ v[1].iov_base = "";
+ v[1].iov_len = 0;
+
+ v[4].iov_base = "";
+ v[4].iov_len = 0;
}
- v[1].iov_base = (char *)msg;
- v[1].iov_len = msgLen;
+ v[2].iov_base = (char *)msg;
+ v[2].iov_len = msgLen;
- v[2].iov_base = "\n";
- v[2].iov_len = (msg[msgLen] == '\n') ? 0 : 1;
+ v[3].iov_base = "\n";
+ v[3].iov_len = (msg[msgLen] == '\n') ? 0 : 1;
- writev(STDERR_FILENO, v, 4);
+ writev(STDERR_FILENO, v, 5);
}
else
{
@@ -1282,56 +1288,62 @@ - (void)logMessage:(DDLogMessage *)logMessage
// Here is our format: "%s %s[%i:%s] %s", timestamp, appName, processID, threadID, logMsg
- struct iovec v[12];
+ struct iovec v[13];
if (colorProfile)
{
v[0].iov_base = colorProfile->fgCode;
v[0].iov_len = colorProfile->fgCodeLen;
-
- v[11].iov_base = colorProfile->resetCode;
- v[11].iov_len = colorProfile->resetCodeLen;
+
+ v[1].iov_base = colorProfile->bgCode;
+ v[1].iov_len = colorProfile->bgCodeLen;
+
+ v[12].iov_base = colorProfile->resetCode;
+ v[12].iov_len = colorProfile->resetCodeLen;
}
else
{
v[0].iov_base = "";
v[0].iov_len = 0;
-
- v[11].iov_base = "";
- v[11].iov_len = 0;
+
+ v[1].iov_base = "";
+ v[1].iov_len = 0;
+
+ v[12].iov_base = "";
+ v[12].iov_len = 0;
}
- v[1].iov_base = ts;
- v[1].iov_len = tsLen;
+ v[2].iov_base = ts;
+ v[2].iov_len = tsLen;
- v[2].iov_base = " ";
- v[2].iov_len = 1;
+ v[3].iov_base = " ";
+ v[3].iov_len = 1;
- v[3].iov_base = app;
- v[3].iov_len = appLen;
+ v[4].iov_base = app;
+ v[4].iov_len = appLen;
- v[4].iov_base = "[";
- v[4].iov_len = 1;
+ v[5].iov_base = "[";
+ v[5].iov_len = 1;
- v[5].iov_base = pid;
- v[5].iov_len = pidLen;
+ v[6].iov_base = pid;
+ v[6].iov_len = pidLen;
- v[6].iov_base = ":";
- v[6].iov_len = 1;
+ v[7].iov_base = ":";
+ v[7].iov_len = 1;
- v[7].iov_base = tid;
- v[7].iov_len = MIN((size_t)8, tidLen); // snprintf doesn't return what you might think
+ v[8].iov_base = tid;
+ v[8].iov_len = MIN((size_t)8, tidLen); // snprintf doesn't return what you might think
- v[8].iov_base = "] ";
- v[8].iov_len = 2;
+ v[9].iov_base = "] ";
+ v[9].iov_len = 2;
- v[9].iov_base = (char *)msg;
- v[9].iov_len = msgLen;
+ v[10].iov_base = (char *)msg;
+ v[10].iov_len = msgLen;
- v[10].iov_base = "\n";
- v[10].iov_len = (msg[msgLen] == '\n') ? 0 : 1;
+ v[11].iov_base = "\n";
+ v[11].iov_len = (msg[msgLen] == '\n') ? 0 : 1;
- writev(STDERR_FILENO, v, 12);
+ writev(STDERR_FILENO, v, 13);
}
if (!useStack) {
Something went wrong with that request. Please try again.