Esempio n. 1
0
void StandardFormatter::format(const LogRecord* record, io::OutputStream& os) const
{
    std::string name = (record->getName().empty()) ? ("DEFAULT") : record->getName();

    // populate log
    long threadId = sys::getThreadID();
    std::string format = mFmt;
    str::replace(format, THREAD_ID, str::toString(threadId));
    str::replace(format, LOG_NAME,  name);
    str::replace(format, LOG_LEVEL, record->getLevelName());
    str::replace(format, TIMESTAMP, record->getTimeStamp());
    if (record->getLineNum() >= 0)
    {
        str::replace(format, FILE_NAME, record->getFile());
        str::replace(format, LINE_NUM,  
                str::toString<int>(record->getLineNum()));
    }
    else
    {
        str::replace(format, FILE_NAME, "");
        str::replace(format, LINE_NUM,  "");
    }
    str::replace(format, FUNCTION, record->getFunction());
    str::replace(format, MESSAGE,  record->getMessage());

    // write to stream
    os.write(format + "\n");
}
Esempio n. 2
0
void tiff::Header::print(io::OutputStream& output) const
{
    std::ostringstream message;
    message << "Type:          " << mByteOrder[0] << mByteOrder[1] << std::endl;
    message << "Version:       " << mId << std::endl;
    message << "IFD Offset:    " << mIFDOffset << std::endl;
    output.write(message.str());
}
Esempio n. 3
0
// INCOMPLETE
void tiff::Header::serialize(io::OutputStream& output)
{
    output.write((sys::byte *)&mByteOrder, sizeof(mByteOrder));
    output.write((sys::byte *)&mId, sizeof(mId));
    output.write((sys::byte *)&mIFDOffset, sizeof(mIFDOffset));
}