Write to log file when using DEBUG=*
#17906
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
This PR improves the debugability of the scanner when using
DEBUG=*
by writing to atailwindcss-{pid}.log
file in the current working directory.It will include all the tracing information from the scanner. This PR also introduces
Discovering {path}
andReading {path}
logs.Discovering {path}
— this is logged when we are traversing the file system looking for files. We use theignore
crate, and log this information in thefilter_entry
callback. If a file was already ignored by.gitignore
files, this won't show up, but it also means that we will not read it.Reading {path}
— this is when we are actually reading the file so we can start extracting potential Tailwind CSS classes.These will give you some insights in what paths are being scanned, and if we get stuck, where we get stuck.
Also, we are appending to the file. In the log below, you can already see that a
tailwindcss-<number>.log
file exists already even though it didn't exist before running the command. This should make it easier to debug if we get stuck on a specific file/folder because the file will be populated with information.There are a few reasons for appending to a file:
@source
directives, you could diff the outputs. (although, the timestamps will be different)DEBUG=*
, a lot of other tools also output debug information, so writing to a file should make this better.Example log
We also output where we are writing the file to. This looks like this when using the CLI:

Last but not least, this also ignores
.log
files by defaultTest plan
Ran the CLI (but you can use any tool real, since this is implemented in Oxide) with the
DEBUG=*
flag.The file generated, looks like the example I shared above.