Skip to content

Commit

Permalink
feat: log clearing support
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Jun 12, 2022
1 parent d970c88 commit 0d8d5b5
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.query_builder import Interval
from frappe.query_builder.functions import Now
from frappe.utils import strip_html
from frappe.utils.data import cstr

Expand All @@ -27,6 +29,13 @@ def _set_title(self):
title = strip_html(title)
self.title = title if len(title) < 100 else title[:100] + "..."

@staticmethod
def clear_old_logs(days=90):
table = frappe.qb.DocType("Ecommerce Integration Log")
frappe.db.delete(
table, filters=((table.modified < (Now() - Interval(days=days)))) & (table.status == "Success")
)


def create_log(
module_def=None,
Expand Down

0 comments on commit 0d8d5b5

Please sign in to comment.