Custom script logging easy way?

I got a custom script server side and I just want to add logging to it, here is sample of my code

from frappe.exceptions import DoesNotExistError

@frappe.whitelist()
def do_some_stuff(args):
    try: 
       frappe.get_list("Issue", "myissue")
       <logging here to show success>
    except DoesNotExistError:
       <I want to add logging here to show something in the logs>

What is the easiest way to go about this assuming either one of these things:

  1. I want to use the default logger object or
  2. I have to create my own logger

@The_Lowkster, use

log = frappe.get_logger("my_module")

log.debug("Some debug")
log.info("Some info")

according python logging module

Ah okay, so it really is easy. Thanks!

How does it know which log file to write to or will I just understand once I read up on python logging module ?

@The_Lowkster, by default it will write the frappe-web.log file in the frappe-bench/logs folder!

If do you need that it write another file, do you need customize the logger for your requirements!

okay.