ScrapeOps / scrapeops-scrapy-sdk

Scrapy extension that gives you all the scraping monitoring, alerting, scheduling, and data validation you will need straight out of the box.
https://scrapeops.io/
BSD 3-Clause "New" or "Revised" License
37 stars 9 forks source link

Fix #12: replace record.asctime with self.format_time #14

Closed HenryDashwood closed 3 months ago

HenryDashwood commented 3 months ago

This might fix #12?

The changes are:

Create this method:

    def format_time(self, record):
        if self.formatter:
            return self.formatter.formatTime(record)
        else:
            # Fallback to a basic time format if no formatter is set
            return time.strftime("%Y-%m-%d %H:%M:%S")

and replace this line:

dateTime = record.asctime

with


dateTime = self.format_time(record)