code
2717 battery_log(BAT_LOG_CRTI, "youchihwang abc10010 xxxaaa8-2 "); 2718 battery_log(BAT_LOG_CRTI, "youchihwang abc10010 xxxaaa8-3 "); ..... ..... ..... 2731 battery_log(BAT_LOG_CRTI, "youchihwang5 CHR_Type_num=%d ", 2732 CHR_Type_num); 2733 battery_log(BAT_LOG_CRTI, "youchihwang6 CHR_Type_num=%d ", 2734 CHR_Type_num);
log
2314 01-01 00:02:29.519233 71 71 E [ 278.055360]: (4)[71:pmic_thread][name:battery_common_fg_20&]youchihwang abc10010 xxxaaa8-2 2315 01-01 00:02:29.519239 71 71 E [ 278.055366]: (4)[71:pmic_thread][name:battery_common_fg_20&]youchihwang abc10010 xxxaaa8-3 .... .... .... 28 01-01 00:01:55.445030 71 71 E [ 243.981157]: (4)[71:pmic_thread][name:battery_common_fg_20&]youchihwang5 CHR_Type_num=3 29 01-01 00:01:55.445038 71 71 E [ 243.981165]: (4)[71:pmic_thread][name:battery_common_fg_20&]youchihwang6 CHR_Type_num=3
小結:
在 kernel 中打 log,
不論是帶有參數的 log,或是沒有帶參數的 log,
在其後加上 " " 或 " " 的結果都是一樣的,
都會移到新的一行。
code
2721 battery_log(BAT_LOG_CRTI, "youchihwang1 CHR_Type_num :%d ", CHR_Type_num); 2723 battery_log(BAT_LOG_CRTI, "youchihwang1-1 CHR_Type_num:%d ", CHR_Type_num); 2725 battery_log(BAT_LOG_CRTI, "youchihwang2 CHR_Type_num :%d ", CHR_Type_num); 2727 battery_log(BAT_LOG_CRTI, "youchihwang3 CHR_Type_num : %d ", CHR_Type_num); 2729 battery_log(BAT_LOG_CRTI, "youchihwang4 CHR_Type_num : %d ", CHR_Type_num); 2731 battery_log(BAT_LOG_CRTI, "youchihwang5 CHR_Type_num =%d ", CHR_Type_num); 2733 battery_log(BAT_LOG_CRTI, "youchihwang6 CHR_Type_num =%d ", CHR_Type_num); 2735 battery_log(BAT_LOG_CRTI, "youchihwang_CHR_Type_num =%d ", CHR_Type_num);
log
23 01-01 00:01:55.444985 71 71 E [ 243.981112](4)[71:pmic_thread][name:battery_common_fg_20&]: 3 24 01-01 00:01:55.445002 71 71 E [ 243.981129](4)[71:pmic_thread][name:battery_common_fg_20&]: 3 25 01-01 00:01:55.445010 71 71 E [ 243.981137](4)[71:pmic_thread][name:battery_common_fg_20&]: 3 26 01-01 00:01:55.445017 71 71 E [ 243.981144](4)[71:pmic_thread][name:battery_common_fg_20&]: 3 27 01-01 00:01:55.445024 71 71 E [ 243.981151](4)[71:pmic_thread][name:battery_, common_fg_20&]: 3 28 01-01 00:01:55.445030 71 71 E [ 243.981157]: (4)[71:pmic_thread][name:battery_common_fg_20&]youchihwang5 CHR_Type_num=3 29 01-01 00:01:55.445038 71 71 E [ 243.981165]: (4)[71:pmic_thread][name:battery_common_fg_20&]youchihwang6 CHR_Type_num=3 30 01-01 00:01:55.445045 71 71 E [ 243.981172]: (4)[71:pmic_thread][name:battery_common_fg_20&]youchihwang_CHR_Type_num=3
小結:
在 kernel 中要打出有帶參數的 log (如上),
比對 前 5 個 與 後 3 個可得知,
在 "%" 前需加上 "=" 。