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

Logging output suggestions #2

Closed
imacrayon opened this issue Mar 16, 2023 · 5 comments
Closed

Logging output suggestions #2

imacrayon opened this issue Mar 16, 2023 · 5 comments

Comments

@imacrayon
Copy link

I'm running this on MacOS, I've installed it through Composer:

  1. The log files that are written to disk don't have any permissions set so I have to chmod them before I can read them.
  2. The JSON in the logs is unformatted (just one long string). It would be helpful if it was pretty-printed so that it was more readable. (Using MarshalIndent might be the fix?)
@MaestroError
Copy link
Owner

MaestroError commented Mar 16, 2023

Thanks, @imacrayon for these really nice suggestions! "2" I already have in my To Do list, but I didn't know about "1", I will note that. For now, logging is just a pre-created feature for future uses, for example, I am going to add the "undo" command with help of logging.

And honestly, I thought that nobody will need the logging feature 😄 so tell me, why do you need the log files?

P.s. If the community will be more active I will harry up with further updates👍

@imacrayon
Copy link
Author

Ah, so I misunderstood the purpose of the logs. In my case I ran replace on a large project and it produced several hundred warnings. My first thought was to look at the logs b/c the warnings were hard to parse in my terminal. I didn’t realize that the logs were different from the terminal output, I thought it was recording the warnings.

@MaestroError
Copy link
Owner

Wow, interesting case! 👍

@imacrayon For now, as quick fix you can run command several times (solve some warnings -> run command again), but I am going to add --report option for similar purpose.

If you still need help with it now, I think, I can help you to export warnings using php script

@MaestroError
Copy link
Owner

Hi, @imacrayon! Added --report option in check and replace commands. Example output (warnings_2023-09-21_00-34_9.json):

{
  "count": 9,
  "run_date": "2023-09-21_00-34",
  "warnings": [
    " 'Testing not found {} () string' - test.blade.php:19",
    " '% Percent %' - test.blade.php:20",
    " 'Testing 'single' quotes' - test.blade.php:21",
    " 'Testing single 'quotes'' - test.blade.php:22",
    " 'Veelgestelde vragen over {{$serviceName}}' - test.blade.php:80",
    " '{{$serviceName}}' - test.blade.php:84, 90",
    " 'Some text with 'quotes'' - test.blade.php:23",
    "Couldn't affix: 'placeholder' in placeholder attribute not allowed - test.blade.php:39",
    " 'John with 'single'' - test.blade.php:25"
  ]
}

@imacrayon
Copy link
Author

Very cool, thanks!

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