Skip to content

Log Formatting

Zubair Rehman edited this page May 3, 2019 · 1 revision

You can apply following log formats:

1. FormatType.FORMAT_CURLY
2. FormatType.FORMAT_SQUARE
3. FormatType.FORMAT_CSV
4. FormatType.FORMAT_CUSTOM

To apply CSV format, you need to provide deliminator, by default it is comma ','. To apply custom formats you need to provide opening & closing character. Like {},[], ' ' etc. An example usage is shown below:

Usage

LogsConfig config = LogsConfig()
  ..customClosingDivider = "|" //supply this only when using FormatType.FORMAT_CUSTOM
  ..customOpeningDivider = "|" //supply this only when using FormatType.FORMAT_CUSTOM
  ..csvDelimiter = ", " //supply this only when using FormatType.FORMAT_CSV
  ..formatType = FormatType.FORMAT_CURLY; //provide any formatting type mentioned above

Logs can then be formatted as below:

1. {TAG}   {FUNCTION_NAME}   {YOUR_LOGGED_EVENT}   {07:05:2017 11:22:17 AM}   {Info}
2. [TAG]   [FUNCTION_NAME]   [YOUR_LOGGED_EVENT]   [07:05:2017 11:22:17 AM]   [Info]
Clone this wiki locally