Skip to content

Instantly share code, notes, and snippets.

View ashen007's full-sized avatar
🥸
Human Coder

Hewarathna A. I. ashen007

🥸
Human Coder
View GitHub Profile
@ashen007
ashen007 / README.md
Created November 24, 2020 15:38 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@ashen007
ashen007 / main.py
Created February 26, 2023 15:18
simple log into terminal
import logging
logging.warning("this is a warning!")
logging.info("just a piece of information.")
@ashen007
ashen007 / main.py
Created February 26, 2023 16:33
log into a seperate file
import logging
logging.basicConfig(filename='.log', encoding='utf-8', level=logging.DEBUG)
logging.debug("this is for debug.")
logging.info("just a piece of information.")
logging.warning("this is a warning!")
logging.error("an error has occurred")
@ashen007
ashen007 / main.py
Created February 26, 2023 17:09
single point of execution
import logging
import module
def main():
logging.basicConfig(filename='.log', encoding='utf-8', level=logging.DEBUG)
logging.info("main is calling do_something from module")
module.do_something()
@ashen007
ashen007 / module.py
Created February 26, 2023 17:10
module file
import logging
def do_something():
print("call this to do somthing")
logging.debug("do somthing executed.")
@ashen007
ashen007 / main.py
Created February 26, 2023 17:30
example 1-1
import logging
from module import lib
def main():
logging.basicConfig(filename='.log', encoding='utf-8', level=logging.DEBUG)
logging.info("main is calling do_something from module")
lib.do_something()
@ashen007
ashen007 / lib.py
Created February 26, 2023 17:31
example 1-1 other module
import logging
def do_something():
print("call this to do somthing")
logging.debug("do somthing executed in module-lib.")
@ashen007
ashen007 / lib_x.py
Created February 27, 2023 03:00
module x submodule
import logging
# configure logging in module_x
# get the named logger object
logger = logging.getLogger(__name__)
# update logging level
logger.setLevel(logging.DEBUG)
@ashen007
ashen007 / lib_y.py
Created February 27, 2023 03:01
module y submodule
import logging
# configure logging module_y
# get the named logger object
logger = logging.getLogger(__name__)
# update logging level
logger.setLevel(logging.DEBUG)
@ashen007
ashen007 / main.py
Created February 27, 2023 03:01
main file for user progam
import logging
from package.module_x import lib_x
from package.module_y import lib_y
# configure logging in user program
# get the named logger object
logger = logging.getLogger(__name__)
# update logging level