File tree Expand file tree Collapse file tree 3 files changed +48
-6
lines changed
ch/user-guide/helper-reference
en/user-guide/helper-reference
ja/user-guide/helper-reference Expand file tree Collapse file tree 3 files changed +48
-6
lines changed Original file line number Diff line number Diff line change @@ -32,17 +32,31 @@ page_id: "080.050"
32
32
参数可以像格式化字符串和变量的printf格式一样传递. 举例, 像这样:
33
33
34
34
``` c++
35
- tError ("Invalid Parameter : value : %d", value);
35
+ tError ("Invalid Parameter, value : %d", value);
36
36
```
37
37
38
38
然后, 下面的记录将会输出到*log/app.log*文件:
39
39
40
40
```
41
- 2011-04-01 21:06:04 ERROR [ 12345678] Invalid Parameter : value : -1
41
+ 2011-04-01 21:06:04 ERROR [ 12345678] Invalid Parameter, value : -1
42
42
```
43
43
44
44
在格式化字符串的尾部不需要换行符.
45
45
46
+ 在 TreeFrog 2.10 及更高版本中,如果编译器支持 stdc++20,则可以使用以下方法来描述 std::format 样式格式化.
47
+
48
+ * Tf::fatal()
49
+ * Tf::error()
50
+ * Tf::warn()
51
+ * Tf::info()
52
+ * Tf::debug()
53
+ * Tf::trace()
54
+
55
+ 其写法如下:
56
+ ```c++
57
+ Tf::error("Invalid Parameter, value : {}", value);
58
+ ```
59
+
46
60
## 更改记录的布局
47
61
48
62
通过设置FileLogger能够改变记录输出的布局. 布局参数在配置文件* logger.ini* 中.
Original file line number Diff line number Diff line change @@ -32,17 +32,31 @@ The application log is used for logging your Web application. There are several
32
32
Arguments that can be passed here are the same as the printf-format of format string and a variable number. For example, like this:
33
33
34
34
``` c++
35
- tError ("Invalid Parameter : value : %d", value);
35
+ tError ("Invalid Parameter, value : %d", value);
36
36
```
37
37
38
38
Then, the following log will be output to the *log/app.log* file:
39
39
40
40
```
41
- 2011-04-01 21:06:04 ERROR [ 12345678] Invalid Parameter : value : -1
41
+ 2011-04-01 21:06:04 ERROR [ 12345678] Invalid Parameter, value : -1
42
42
```
43
43
44
44
Line feed code is not required at the end of the format string.
45
45
46
+ In TreeFrog version 2.10 and later, if the compiler supports stdc++20, you can use the following methods to describe std::format style formatting.
47
+
48
+ * Tf::fatal()
49
+ * Tf::error()
50
+ * Tf::warn()
51
+ * Tf::info()
52
+ * Tf::debug()
53
+ * Tf::trace()
54
+
55
+ It can be written as follows:
56
+ ```c++
57
+ Tf::error("Invalid Parameter, value : {}", value);
58
+ ```
59
+
46
60
## Changing Log Layout
47
61
48
62
It is possible to change the layout of the log output, by setting FileLogger.Layout parameters in the configuration file * logger.ini* .
Original file line number Diff line number Diff line change @@ -32,17 +32,31 @@ Webアプリは、以下の4つのログを出力します。
32
32
渡せる引数は printf 形式と同じで、フォーマット文字列と可変個の変数です。例えば、こんな感じに使います。
33
33
34
34
``` c++
35
- tError ("Invalid Parameter : value : %d", value);
35
+ tError ("Invalid Parameter, value : %d", value);
36
36
```
37
37
38
38
すると、次のようなログが log/app.log ファイルに出力されるでしょう。
39
39
40
40
```
41
- 2011-04-01 21:06:04 ERROR [ 12345678] Invalid Parameter : value : -1
41
+ 2011-04-01 21:06:04 ERROR [ 12345678] Invalid Parameter, value : -1
42
42
```
43
43
44
44
フォーマット文字列の末尾には改行コードは不要です。
45
45
46
+ TreeFrog バージョン2.10以降では、stdc++20をサポートしたコンパイラであれば、次のメソッドで std::format スタイルの書式を記述できます。
47
+
48
+ * Tf::fatal()
49
+ * Tf::error()
50
+ * Tf::warn()
51
+ * Tf::info()
52
+ * Tf::debug()
53
+ * Tf::trace()
54
+
55
+ 次のように記述できます。
56
+ ```c++
57
+ Tf::error("Invalid Parameter, value : {}", value);
58
+ ```
59
+
46
60
## ログのレイアウト変更
47
61
48
62
出力されるログのレイアウトを変更することが可能です。logger.ini 設定ファイルにある FileLogger.Layout パラメータに設定します。
You can’t perform that action at this time.
0 commit comments