Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 828007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:39:45+00:00 2026-05-15T03:39:45+00:00

I typically write my scripts with a structure like s #!/usr/bin/python import stuff def

  • 0

I typically write my scripts with a structure like s

#!/usr/bin/python

import stuff

def do_things():
    print "FOO"

def main():
    do_things()

if __name__ == "__main__":
    main()

The problem I have is I’d like to have a logging function that is defined globally and I”m not really sure how to do this. I tried a decorator function but if I define it in main I can’t call it from other functions in the script. It seems like something that should be easy to do but not something I have experience with.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:39:46+00:00Added an answer on May 15, 2026 at 3:39 am
    import logging
    

    Python’s logging library should satisfy your requirements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I typically write something like this: class Person < ActiveRecord::Base attr_accessible :first_name, :last_name def
I would like to write simple scripts in C#. Stuff I would normally use
Typically, I've seen people use the class literal like this: Class<Foo> cls = Foo.class;
Typically I have to write layout code like this: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical
Good day, I typically write rather simple BASH scripts on a routine basis. I
Typically you start a service like this Intent i = new Intent(context,MessageService.class); context.startService(i); but
In working on side projects, I typically write code best around 7pm-8pm, with a
I know EXIT_SUCCESS / EXIT_FAILURE is typically used for main() exit to indicate the
I typically use extension methods very sparingly. When I do feel compelled to write
Typically when you're writing a .jsx script to automate an Adobe product (like InDesign,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.