Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing empty fields #20

Open
pawlowskim opened this issue Mar 2, 2020 · 2 comments
Open

Missing empty fields #20

pawlowskim opened this issue Mar 2, 2020 · 2 comments
Assignees

Comments

@pawlowskim
Copy link

pawlowskim commented Mar 2, 2020

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: #21

@zubairehman
Copy link
Owner

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

@zubairehman zubairehman self-assigned this Mar 4, 2020
@pawlowskim
Copy link
Author

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.

#53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants