Exemple #1
0
		~RequestLogger()
		{
			x0::Buffer sstr;
			sstr << hostname(in_);
			sstr << " - "; // identity as of identd
			sstr << username(in_) << ' ';
			sstr << in_->connection.worker().now().htlog_str().c_str() << " \"";
			sstr << request_line(in_) << "\" ";
			sstr << static_cast<int>(in_->status) << ' ';
			sstr << in_->bytesTransmitted() << ' ';
			sstr << '"' << getheader(in_, "Referer") << "\" ";
			sstr << '"' << getheader(in_, "User-Agent") << '"';
			sstr << '\n';

			if (log_->write(sstr.c_str(), sstr.size()) < static_cast<ssize_t>(sstr.size())) {
				in_->log(x0::Severity::error, "Could not write to accesslog target. %s", strerror(errno));
			}
		}
Exemple #2
0
		~RequestLogger()
		{
			x0::Buffer sstr;
			sstr << hostname(in_);
			sstr << " - "; // identity as of identd
			sstr << username(in_) << ' ';
			sstr << in_->connection.worker().now().htlog_str().c_str() << " \"";
			sstr << request_line(in_) << "\" ";
			sstr << static_cast<int>(in_->status) << ' ';
			sstr << in_->bytesTransmitted() << ' ';
			sstr << '"' << getheader(in_, "Referer") << "\" ";
			sstr << '"' << getheader(in_, "User-Agent") << '"';
			sstr << '\n';

			int rv = ::write(fd_, sstr.data(), sstr.size());

			if (rv < 0) {
				perror("accesslog.write");
			}
		}