MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / write

Method write

Utilities/Logger.h:69–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 }
68
69 virtual void write(const LogLevel level, const std::string &str)
70 {
71 if (level < m_minLevel)
72 return;
73
74 // print time
75 time_t t = time(0); // get time now
76 struct tm * now = localtime(&t);
77 m_file << "[" << (now->tm_year + 1900) << '-'
78 << std::setfill('0') << std::setw(2)
79 << (now->tm_mon + 1) << '-'
80 << std::setfill('0') << std::setw(2)
81 << now->tm_mday << " "
82 << std::setfill('0') << std::setw(2)
83 << now->tm_hour << ":"
84 << std::setfill('0') << std::setw(2)
85 << now->tm_min << ":"
86 << std::setfill('0')
87 << std::setw(2) << now->tm_sec << "] ";
88
89 // print level
90 if (level == LogLevel::DEBUG)
91 m_file << "Debug: ";
92 else if (level == LogLevel::INFO)
93 m_file << "Info: ";
94 else if (level == LogLevel::WARN)
95 m_file << "Warning: ";
96 else if (level == LogLevel::ERR)
97 m_file << "Error: ";
98
99 m_file << str << std::endl;
100 m_file.flush();
101 }
102 };
103
104 class BufferSink : public Utilities::LogSink

Callers

nothing calls this directly

Calls 1

flushMethod · 0.80

Tested by

no test coverage detected