class LogStreamBuf : public std::streambuf {
  public:
  // REQUIREMENTS: "len" must be >= 2 to account for the '\n' and '\n'.
  LogStreamBuf(char *buf, int len) {
    setp(buf, buf + len - );
  }
  // This effectively ignores overflow.
  virtual int_type overflow(int_type ch) {
    return ch;
  }   // Legacy public ostrstream method.
  size_t pcount() const { return pptr() - pbase(); }
  char* pbase() const { return std::streambuf::pbase(); }
};
class LogStream : public std::ostream {
public:
  LogStream(char *buf, int len, int ctr)
  : std::ostream(NULL),
  streambuf_(buf, len),
  ctr_(ctr),
  self_(this) { rdbuf(&streambuf_);}   int ctr() const { return ctr_; }
  void set_ctr(int ctr) { ctr_ = ctr; }
  LogStream* self() const { return self_; }   // Legacy std::streambuf methods.
  size_t pcount() const { return streambuf_.pcount(); }
   char* pbase() const { return streambuf_.pbase(); }
   char* str() const { return pbase(); } private:
   base_logging::LogStreamBuf streambuf_;
  int ctr_; // Counter hack (for the LOG_EVERY_X() macro)
  LogStream *self_; // Consistency check hack
};

最新文章

  1. 在C++中实现字符串分割--split
  2. SUDTOJ 3323园艺问题 (线段树)
  3. iOS 图片循环滚动(切片效果)
  4. SSM框架搭建
  5. Ubuntu16.04+hadoop2.7.3环境搭建
  6. linux 防火墙 iptables实例讲解
  7. js智能提示代码
  8. 数据挖掘_wget整站下载
  9. 解决xshell评估期已过的问题
  10. UNIX网络编程——处理服务器中大量的TIME_WAIT
  11. C#爬虫使用代理刷csdn文章浏览量
  12. docker容器下mysql更改WordPress的site address和home(URL)------局域网
  13. Hadoop项目实战-用户行为分析之应用概述(一)
  14. 2018.11.01 NOIP训练 梭哈(模拟)
  15. NodeJS之Mac初体验
  16. HDUOJ----专题训练C
  17. VI打开和编辑多个文件的命令
  18. 使用explain分析sql语句
  19. apache kafka监控系列-KafkaOffsetMonitor(转)
  20. 按键精灵saystring无法使用的几种解决方案

热门文章

  1. WCF bindings comparison z
  2. [Java] 实现一个基于命令行的用户管理
  3. crm 4 隐藏自定义 toolbar
  4. glctx.ClearColor 参数说明
  5. [ZOJ 1005] Jugs (dfs倒水问题)
  6. [POJ 2063] Investment (动态规划)
  7. 最大子序列和(O(n))
  8. Node.js异常处理
  9. 重设mysql的root密码,MAC OSX
  10. 软件测试入门——测试模型(V型 W型 H型)