Exemple #1
0
char *
parcTime_TimeAsRFC3339(const time_t utcTime, char result[64])
{
    struct timeval theTime = { utcTime, 0 };

    return parcTime_TimevalAsRFC3339(&theTime, result);
}
Exemple #2
0
PARCBuffer *
parcLogFormatText_FormatEntry(const PARCLogEntry *entry)
{
    PARCBuffer *payload = parcLogEntry_GetPayload(entry);

    char theTime[64];
    parcTime_TimevalAsRFC3339(parcLogEntry_GetTimeStamp(entry), theTime);

    PARCBufferComposer *composer = parcBufferComposer_Allocate(128);

    parcBufferComposer_PutStrings(composer,
                                  theTime, " ",
                                  parcLogLevel_ToString(parcLogEntry_GetLevel(entry)), " ",
                                  parcLogEntry_GetHostName(entry), " ",
                                  parcLogEntry_GetApplicationName(entry), " ",
                                  parcLogEntry_GetProcessName(entry), " ", NULL);

    parcBufferComposer_Format(composer, "%" PRId64 " [ ", parcLogEntry_GetMessageId(entry));
    parcBufferComposer_PutBuffer(composer, payload);
    parcBufferComposer_PutStrings(composer, " ]\n", NULL);
    PARCBuffer *result = parcBuffer_Flip(parcBuffer_Acquire(parcBufferComposer_GetBuffer(composer)));

    parcBufferComposer_Release(&composer);

    return result;
}
Exemple #3
0
char *
parcTime_NowAsRFC3339(char result[64])
{
    struct timeval theTime;
    gettimeofday(&theTime, NULL);

    return parcTime_TimevalAsRFC3339(&theTime, result);
}