From f68bc4143d5ef475ba87424fe963317284a19b9b Mon Sep 17 00:00:00 2001 From: Ferdinand Neman Date: Fri, 4 Jul 2025 14:32:19 +0700 Subject: [PATCH] Increased some version stated in the docs to better reflect current version, and added documentation about NoopLogger logging for more neutral version of logging --- docs/cn/FAQ_cn.md | 41 ++++++++++++++++++++++++++++++++++++++++ docs/cn/Tutorial_cn.md | 2 +- docs/de/FAQ_de.md | 42 +++++++++++++++++++++++++++++++++++++++++ docs/de/Tutorial_de.md | 2 +- docs/en/FAQ_en.md | 41 ++++++++++++++++++++++++++++++++++++++++ docs/en/Tutorial_en.md | 2 +- docs/id/FAQ_id.md | 43 +++++++++++++++++++++++++++++++++++++++++- docs/id/Tutorial_id.md | 2 +- docs/pl/FAQ_pl.md | 42 +++++++++++++++++++++++++++++++++++++++++ docs/pl/Tutorial_pl.md | 2 +- 10 files changed, 213 insertions(+), 6 deletions(-) diff --git a/docs/cn/FAQ_cn.md b/docs/cn/FAQ_cn.md index 7eb0d454..9dedc9ea 100644 --- a/docs/cn/FAQ_cn.md +++ b/docs/cn/FAQ_cn.md @@ -171,3 +171,44 @@ logger.SetLogLevel(logrus.PanicLevel) 上面代码将会将Grule的日志级别设置成 `Panic` 级别, 只有当panic发生的时候才会记录日志. 当然,修改日志级别可以减少你debug系统的能力,所以我们建议在生产环境才使用更高级别的日志级别。 + +--- + +**Question**: I've just upgraded Grule to the newest version, suddenly no log comes out of Grule? + +**Answer**: Yes, as of Grule v1.20.1 a new NoopLogger were introduced. This provide a plain and neutral logging framework Grule. +This allows grule to use logging framework of your choice, what ever it is. Here is how: + +1. Create your own version of Logger by implementing "logger.Logger" interface, in this example lets call it `MyLogger`. + +```go +type MyLogger struct {} +func (myLog *MyLogger) Debug(args ...interface{}) { + .. code to add debug log here .. +} +Info(args ...interface{}){ +.. code to add info log here .. +} +Warn(args ...interface{}){ +.. code to add warn log here .. +} +... and so on +``` + +2. Instantiate `MyLogger` and add this to `logger.LogEntry` with its default LogLevel (`logger.Level`), + +```go +myLogEntry := &LogEntry { + Logger : &MyLogger{}, + Level : DebugLevel, +} +``` + +3. Set `logger.Log` to use your new `LogEntry` + +```go +logger.Log := myLogEntry +``` + +If you're already uses `Logrus` or `ZapLog` or `ZeroLog`, you could straightly uses +`logger.SetLogger()` function and Grule will use your logger straight away. diff --git a/docs/cn/Tutorial_cn.md b/docs/cn/Tutorial_cn.md index 696fafd4..9ad68ec2 100644 --- a/docs/cn/Tutorial_cn.md +++ b/docs/cn/Tutorial_cn.md @@ -12,7 +12,7 @@ ## 准备 -Grule 使用的Go 1.16版本。 +Grule 使用的Go 1.24.4版本。 以如下的方式在你的项目中引入Grule. diff --git a/docs/de/FAQ_de.md b/docs/de/FAQ_de.md index 8414547e..9d54b8e1 100644 --- a/docs/de/FAQ_de.md +++ b/docs/de/FAQ_de.md @@ -247,3 +247,45 @@ This will set Grule's log to `Panic` level, where it will only emits log when it Of course, modifying the log level reduces your ability to debug the system so we suggest that a higher log level setting only be instituted in production environments. + + +--- + +**Question**: I've just upgraded Grule to the newest version, suddenly no log comes out of Grule? + +**Answer**: Yes, as of Grule v1.20.1 a new NoopLogger were introduced. This provide a plain and neutral logging framework Grule. +This allows grule to use logging framework of your choice, what ever it is. Here is how: + +1. Create your own version of Logger by implementing "logger.Logger" interface, in this example lets call it `MyLogger`. + +```go +type MyLogger struct {} +func (myLog *MyLogger) Debug(args ...interface{}) { + .. code to add debug log here .. +} +Info(args ...interface{}){ +.. code to add info log here .. +} +Warn(args ...interface{}){ +.. code to add warn log here .. +} +... and so on +``` + +2. Instantiate `MyLogger` and add this to `logger.LogEntry` with its default LogLevel (`logger.Level`), + +```go +myLogEntry := &LogEntry { + Logger : &MyLogger{}, + Level : DebugLevel, +} +``` + +3. Set `logger.Log` to use your new `LogEntry` + +```go +logger.Log := myLogEntry +``` + +If you're already uses `Logrus` or `ZapLog` or `ZeroLog`, you could straightly uses +`logger.SetLogger()` function and Grule will use your logger straight away. \ No newline at end of file diff --git a/docs/de/Tutorial_de.md b/docs/de/Tutorial_de.md index 4c21abb9..a39da996 100644 --- a/docs/de/Tutorial_de.md +++ b/docs/de/Tutorial_de.md @@ -25,7 +25,7 @@ __THIS PAGE IS BEING TRANSLATED__ ## Preparation -Please note that Grule is using Go 1.13. +Please note that Grule is using Go 1.24.4. To import Grule into your project: diff --git a/docs/en/FAQ_en.md b/docs/en/FAQ_en.md index 5f416f5e..187cdbbb 100644 --- a/docs/en/FAQ_en.md +++ b/docs/en/FAQ_en.md @@ -234,3 +234,44 @@ This will set Grule's log to `Panic` level, where it will only emits log when it Of course, modifying the log level reduces your ability to debug the system so we suggest that a higher log level setting only be instituted in production environments. + +--- + +**Question**: I've just upgraded Grule to the newest version, suddenly no log comes out of Grule? + +**Answer**: Yes, as of Grule v1.20.1 a new NoopLogger were introduced. This provide a plain and neutral logging framework Grule. +This allows grule to use logging framework of your choice, what ever it is. Here is how: + +1. Create your own version of Logger by implementing "logger.Logger" interface, in this example lets call it `MyLogger`. + +```go +type MyLogger struct {} +func (myLog *MyLogger) Debug(args ...interface{}) { + .. code to add debug log here .. +} +Info(args ...interface{}){ +.. code to add info log here .. +} +Warn(args ...interface{}){ +.. code to add warn log here .. +} +... and so on +``` + +2. Instantiate `MyLogger` and add this to `logger.LogEntry` with its default LogLevel (`logger.Level`), + +```go +myLogEntry := &LogEntry { + Logger : &MyLogger{}, + Level : DebugLevel, +} +``` + +3. Set `logger.Log` to use your new `LogEntry` + +```go +logger.Log := myLogEntry +``` + +If you're already uses `Logrus` or `ZapLog` or `ZeroLog`, you could straightly uses +`logger.SetLogger()` function and Grule will use your logger straight away. \ No newline at end of file diff --git a/docs/en/Tutorial_en.md b/docs/en/Tutorial_en.md index db3dd2f4..3397b4bf 100644 --- a/docs/en/Tutorial_en.md +++ b/docs/en/Tutorial_en.md @@ -12,7 +12,7 @@ ## Preparation -Please note that Grule is using Go 1.16. +Please note that Grule is using Go 1.24.4. To import Grule into your project: diff --git a/docs/id/FAQ_id.md b/docs/id/FAQ_id.md index 549ae0eb..ab9d47d4 100644 --- a/docs/id/FAQ_id.md +++ b/docs/id/FAQ_id.md @@ -234,4 +234,45 @@ Cara ini akan membuat Grule hanya mengeluarkan Log apabila iya panik. Tentu saja, mengubah peringkat log ini mengurangi kemampuan anda untuk melakukan debugging, karenanya, kami sarankan agar anda meningkatkan peringat log seperti ini hanya pada sistem -produksi saja (production environment) \ No newline at end of file +produksi saja (production environment) + +--- + +**Question**: I've just upgraded Grule to the newest version, suddenly no log comes out of Grule? + +**Answer**: Yes, as of Grule v1.20.1 a new NoopLogger were introduced. This provide a plain and neutral logging framework Grule. +This allows grule to use logging framework of your choice, what ever it is. Here is how: + +1. Create your own version of Logger by implementing "logger.Logger" interface, in this example lets call it `MyLogger`. + +```go +type MyLogger struct {} +func (myLog *MyLogger) Debug(args ...interface{}) { + .. code to add debug log here .. +} +Info(args ...interface{}){ +.. code to add info log here .. +} +Warn(args ...interface{}){ +.. code to add warn log here .. +} +... and so on +``` + +2. Instantiate `MyLogger` and add this to `logger.LogEntry` with its default LogLevel (`logger.Level`), + +```go +myLogEntry := &LogEntry { + Logger : &MyLogger{}, + Level : DebugLevel, +} +``` + +3. Set `logger.Log` to use your new `LogEntry` + +```go +logger.Log := myLogEntry +``` + +If you're already uses `Logrus` or `ZapLog` or `ZeroLog`, you could straightly uses +`logger.SetLogger()` function and Grule will use your logger straight away. \ No newline at end of file diff --git a/docs/id/Tutorial_id.md b/docs/id/Tutorial_id.md index 82a50fb9..0a1704e5 100644 --- a/docs/id/Tutorial_id.md +++ b/docs/id/Tutorial_id.md @@ -25,7 +25,7 @@ __THIS PAGE IS BEING TRANSLATED__ ## Persiapan -Mohon dicatat bahwa Grule menggunakan Go 1.13 +Mohon dicatat bahwa Grule menggunakan Go 1.24.4 Untuk menggunakan Grule didalam proyek anda, cukup dengan mudah masukannya. diff --git a/docs/pl/FAQ_pl.md b/docs/pl/FAQ_pl.md index 7c31a9fc..5ba367fe 100644 --- a/docs/pl/FAQ_pl.md +++ b/docs/pl/FAQ_pl.md @@ -170,3 +170,45 @@ logger.SetLogLevel(logrus.PanicLevel) To ustawi log Grule'a na poziom `Panic`, gdzie będzie on wysyłał log tylko wtedy, gdy wpadnie w panikę. Oczywiście, modyfikacja poziomu logów zmniejsza możliwości debugowania systemu, dlatego sugerujemy, aby wyższy poziom logów był ustawiany tylko w środowiskach produkcyjnych. + + +--- + +**Question**: I've just upgraded Grule to the newest version, suddenly no log comes out of Grule? + +**Answer**: Yes, as of Grule v1.20.1 a new NoopLogger were introduced. This provide a plain and neutral logging framework Grule. +This allows grule to use logging framework of your choice, what ever it is. Here is how: + +1. Create your own version of Logger by implementing "logger.Logger" interface, in this example lets call it `MyLogger`. + +```go +type MyLogger struct {} +func (myLog *MyLogger) Debug(args ...interface{}) { + .. code to add debug log here .. +} +Info(args ...interface{}){ +.. code to add info log here .. +} +Warn(args ...interface{}){ +.. code to add warn log here .. +} +... and so on +``` + +2. Instantiate `MyLogger` and add this to `logger.LogEntry` with its default LogLevel (`logger.Level`), + +```go +myLogEntry := &LogEntry { + Logger : &MyLogger{}, + Level : DebugLevel, +} +``` + +3. Set `logger.Log` to use your new `LogEntry` + +```go +logger.Log := myLogEntry +``` + +If you're already uses `Logrus` or `ZapLog` or `ZeroLog`, you could straightly uses +`logger.SetLogger()` function and Grule will use your logger straight away. \ No newline at end of file diff --git a/docs/pl/Tutorial_pl.md b/docs/pl/Tutorial_pl.md index 88955fbf..cc72b26b 100644 --- a/docs/pl/Tutorial_pl.md +++ b/docs/pl/Tutorial_pl.md @@ -12,7 +12,7 @@ ## Przygotowanie -Należy pamiętać, że Grule używa Go 1.16. +Należy pamiętać, że Grule używa Go 1.24.4. Aby zaimportować Grule do swojego projektu: