报告1:COUT问题 郝伟 2021/03/10 [TOC]

1. 1 背景

  • 项目交付一直延期
  • 项目质量需要提高
  • 计划逐步完成项目代码修改

2. 2 统计

2.1. 2.1 代码量echo

find -name "*.cpp" -o -name "*.h" | xargs wc

2.2. 2.2 Cout内容

"Lines,Words,Chars,Filename" > results.csv & rm cout.txt & \
for file in $(find . \( -name "*.h" -o -name "*.cpp" \) -print); \
  do echo $file; \
  echo "---------- $file ----------" >> cout.txt | cat $file | grep cout >> cout.txt; \
  cat $file | grep cout | wc | xargs -I {} echo {}  $file | awk '{printf "%s,%s,%s,%s\n", $1, $2, $3, $4}' >> results.csv; \
done

2.3. 2.3 Cout统计

for file in $(find . \( -name '*.cpp' -o -name '*.h' \) -print); \
    do echo $file; cat $file | grep cout | wc -l | xargs -I {} echo "{},$file"; \
done

3. 3 问题

  • 归属不明:每一条消息属于谁难以确认。
  • 格式不规范:每条消息都有自己的格式,所以无法统一进行处理。
  • 强制显示:每个消息都会显示,难以使用统一的方法关闭显示。
  • 没有记录:日志本身暂时无法记录。
  • 影响性能:数据量大量对性能的影响是可观的。

4. 4 日志设计

  • 安全可信
  • 功能够用
  • 性能高效
  • 统一管理
  • 方便开关
  • 易用使用

results matching ""

    No results matching ""