Committed by
GitHub
Merge pull request #484 from stefandevo/master
Docs updated for logWriterCallback option
Showing
2 changed files
with
32 additions
and
0 deletions
@@ -482,6 +482,22 @@ Get.config( | @@ -482,6 +482,22 @@ Get.config( | ||
482 | ) | 482 | ) |
483 | ``` | 483 | ``` |
484 | 484 | ||
485 | +You can optionally redirect all the logging messages from Get. If you want to use your own favourite logging package and want to capture the logs there. | ||
486 | + | ||
487 | +```dart | ||
488 | +GetMaterialApp( | ||
489 | + enableLog: true, | ||
490 | + logWriterCallback: localLogWriter, | ||
491 | +); | ||
492 | + | ||
493 | +void localLogWriter(String text, {bool isError = false}) { | ||
494 | + // pass the message to your favourite logging package here | ||
495 | + // please note that even if enableLog: false log messages will be pushed in this callback | ||
496 | + // you get check the flag if you want through GetConfig.isLogEnable | ||
497 | +} | ||
498 | + | ||
499 | +``` | ||
500 | + | ||
485 | ## Video explanation of Other GetX Features | 501 | ## Video explanation of Other GetX Features |
486 | 502 | ||
487 | 503 |
@@ -473,6 +473,22 @@ Get.config( | @@ -473,6 +473,22 @@ Get.config( | ||
473 | ) | 473 | ) |
474 | ``` | 474 | ``` |
475 | 475 | ||
476 | +É possível redirecionar todas as mensagens de log do GetX. Útil quando se tem um package de logging e vc quer que ele lide com todos os logs | ||
477 | + | ||
478 | +```dart | ||
479 | +GetMaterialApp( | ||
480 | + enableLog: true, | ||
481 | + logWriterCallback: localLogWriter, | ||
482 | +); | ||
483 | + | ||
484 | +void localLogWriter(String text, {bool isError = false}) { | ||
485 | + // passage a mensagem para seu package de logging favorito aqui | ||
486 | + // Obs: mesmo que as mensagens de log estejam desativadas | ||
487 | + // com o comando "enableLog: false", as mensagens ainda vão passar por aqui | ||
488 | + // Você precisa checar essa config manualmente aqui se quiser respeitá-la | ||
489 | +} | ||
490 | +``` | ||
491 | + | ||
476 | ## Video explanation of Other GetX Features | 492 | ## Video explanation of Other GetX Features |
477 | 493 | ||
478 | 494 |
-
Please register or login to post a comment