Flogs icon indicating copy to clipboard operation
Flogs copied to clipboard

Missing empty fields

Open pawlowskim opened this issue 4 years ago • 2 comments

I'm not quite sure why there is no empty fields in exported logs. For instance, if you don't specify exception / stacktrace it returns empty string. This is bad, since you don't know which part of the logs you are missing. This is required if you want to parse logs on other system, fe. google Stackdriver.

  static String _formatCurly(Log log, bool isDevelopmentDebuggingEnabled) {
    String output;

    if (log != null) {
      output = "{${log.className}} ";
      output += "{${log.methodName}} ";
      output += "{${log.text}} ";
      output += log.exception != 'null' ? "{${log.exception}} " : "";
      output += "{${log.logLevel.toString()}} ";
      output += "{${log.timestamp}} ";
      output += log.stacktrace != 'null' ? "{${log.stacktrace}} " : "";

      if (isDevelopmentDebuggingEnabled) {
        output += !kReleaseMode ? "{${log.dataLogType}} " : "";
        output += !kReleaseMode ? "{${log.timeInMillis}}" : "";
      }
    }

    return output;
  }

IMO it should return empty {} so we can easily split each row and parse it more easily. This could be easily configured via cfg file to keep backward compatibility.

PR for this created: https://github.com/zubairehman/Flogs/pull/21

pawlowskim avatar Mar 02 '20 15:03 pawlowskim

thanks for the pull request, will review and merge soon :)

zubairehman avatar Mar 04 '20 06:03 zubairehman

So, after over a year, I'm bumping it up :) I have created new PR. Please take a look @zubairehman . It doesn't change default behaviour, it extends it if you configure it in a different way.

https://github.com/zubairehman/Flogs/pull/53

pawlowskim avatar May 28 '21 13:05 pawlowskim