<filename>mokapay/mokapay/doctype/mokapay_request/mokapay_request.py
# @Author: <NAME> <developer>
# @Date:   2019-01-21T13:44:15+03:00
# @Email:  <EMAIL>
# @Project: Harpiya Kurumsal Yönetim Sistemi
# @Filename: mokapay_request.py
# @Last modified by:   developer
# @Last modified time: 2019-01-21T15:32:05+03:00
# @License: MIT License. See license.txt
# @Copyright: Harpiya Yazılım Teknolojileri



# -*- coding: utf-8 -*-
# Copyright (c) 2015, DigiThinkIT, Inc. and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from datetime import datetime

LOG_LEVELS = {
	"None": 0,
	"Info": 1,
	"Error": 2,
	"Debug": 3
}

class MokaPayRequest(Document):

	def max_log_level(self, level):
		self._max_log_level = LOG_LEVELS[level]

	def log_action(self, data, level):
		if LOG_LEVELS[level] <= self._max_log_level:
			self.append("log",{
				"doctype": "MokaPay Request Log",
				"log": data,
				"level": level,
				"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
			})

<filename>mokapay/mokapay/doctype/mokapay_request/mokapay_request.py
# @Author: <NAME> <developer>
# @Date:   2019-01-21T13:44:15+03:00
# @Email:  <EMAIL>
# @Project: Harpiya Kurumsal Yönetim Sistemi
# @Filename: mokapay_request.py
# @Last modified by:   developer
# @Last modified time: 2019-01-21T15:32:05+03:00
# @License: MIT License. See license.txt
# @Copyright: Harpiya Yazılım Teknolojileri



# -*- coding: utf-8 -*-
# Copyright (c) 2015, DigiThinkIT, Inc. and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from datetime import datetime

LOG_LEVELS = {
	"None": 0,
	"Info": 1,
	"Error": 2,
	"Debug": 3
}

class MokaPayRequest(Document):

	def max_log_level(self, level):
		self._max_log_level = LOG_LEVELS[level]

	def log_action(self, data, level):
		if LOG_LEVELS[level] <= self._max_log_level:
			self.append("log",{
				"doctype": "MokaPay Request Log",
				"log": data,
				"level": level,
				"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
			})

# @Author: <NAME> <developer> # @Date:   2019-01-21T13:44:15+03:00 # @Email:  <EMAIL> # @Project: Harpiya Kurumsal Yönetim Sistemi # @Filename: mokapay_request.py # @Last modified by:   developer # @Last modified time: 2019-01-21T15:32:05+03:00 # @License: MIT License. See license.txt # @Copyright: Harpiya Yazılım Teknolojileri # -*- coding: utf-8 -*- # Copyright (c) 2015, DigiThinkIT, Inc. and contributors # For license information, please see license.txt