コード例 #1
0
ファイル: LogHandlerFile.cpp プロジェクト: mlbrock/MlbDev
//	////////////////////////////////////////////////////////////////////////////
void LogHandlerXFile::EmitLineImpl(const LogEmitControl &emit_control)
{
	if (out_file_ptr_ != NULL) {
		out_file_ptr_->write(emit_control.GetLeaderPtr(),
			static_cast<std::streamsize>(emit_control.GetLeaderLength()));
		out_file_ptr_->write(emit_control.line_buffer_.c_str(),
			static_cast<std::streamsize>(emit_control.line_buffer_.size()));
		*out_file_ptr_ << std::endl;
// CODE NOTE: Shouldn't flush unless actually desired by user.
//		out_file_ptr_->flush();
	}
}
コード例 #2
0
//	////////////////////////////////////////////////////////////////////////////
void LogHandlerFileBase::EmitLiteral(const LogEmitControl &emit_control,
	unsigned int literal_length, const char *literal_string)
{
	if (emit_control.ShouldLogPersistent() || emit_control.ShouldLogScreen()) {
		boost::mutex::scoped_lock my_lock(the_lock_);
		if (emit_control.ShouldLogPersistent())
			EmitLiteralImpl(literal_length, literal_string);
		if ((!(my_flags_ & NoConsoleOutput)) && emit_control.ShouldLogScreen()) {
			std::cout.write(literal_string,
				static_cast<std::streamsize>(literal_length));
			std::cout << std::endl;
		}
	}
}
コード例 #3
0
//	////////////////////////////////////////////////////////////////////////////
void LogHandlerFileBase::EmitLine(const LogEmitControl &emit_control)
{
	if (emit_control.ShouldLogPersistent() || emit_control.ShouldLogScreen()) {
		boost::mutex::scoped_lock my_lock(the_lock_);
		emit_control.UpdateTime();
		if (emit_control.ShouldLogPersistent())
			EmitLineImpl(emit_control);
		if ((!(my_flags_ & NoConsoleOutput)) && emit_control.ShouldLogScreen()) {
			std::cout.write(emit_control.GetLeaderPtr(),
				static_cast<std::streamsize>(emit_control.GetLeaderLength()));
			std::cout.write(emit_control.line_buffer_.c_str(),
				static_cast<std::streamsize>(emit_control.line_buffer_.size()));
			std::cout << std::endl;
		}
	}
}