Compare commits
2 commits
master
...
use-loggin
Author | SHA1 | Date | |
---|---|---|---|
|
7d6ce1864a | ||
|
9e71019f2d |
2 changed files with 13 additions and 8 deletions
|
@ -22,9 +22,10 @@ import itertools
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import platform
|
import platform
|
||||||
|
import logging
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
MODULE = pathlib.Path(__file__).parent
|
MODULE = pathlib.Path(__file__).parent
|
||||||
|
|
||||||
def raylib_library_path():
|
def raylib_library_path():
|
||||||
|
@ -54,9 +55,9 @@ ffi.cdef(open(MODULE / "raylib_modified.h").read().replace('RLAPI ', ''))
|
||||||
try:
|
try:
|
||||||
raylib_fname = raylib_library_path()
|
raylib_fname = raylib_library_path()
|
||||||
rl = ffi.dlopen(raylib_fname)
|
rl = ffi.dlopen(raylib_fname)
|
||||||
print('LOADED DYNAMICALLY SHARED LIB {} {}'.format(__version__, raylib_fname))
|
logger.warning('LOADED DYNAMICALLY SHARED LIB {} {}'.format(__version__, raylib_fname))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
logger.exception(e)
|
||||||
|
|
||||||
LIGHTGRAY =( 200, 200, 200, 255 )
|
LIGHTGRAY =( 200, 200, 200, 255 )
|
||||||
GRAY =( 130, 130, 130, 255 )
|
GRAY =( 130, 130, 130, 255 )
|
||||||
|
|
|
@ -13,18 +13,22 @@
|
||||||
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ._raylib_cffi import ffi, lib as rl
|
from ._raylib_cffi import ffi, lib as rl
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
print("\n*** ERROR LOADING NATIVE CODE ***\n")
|
logger.error("*** ERROR LOADING NATIVE CODE ***")
|
||||||
print("See https://github.com/electronstudio/raylib-python-cffi/issues/142\n", file=sys.stderr)
|
logger.error("See https://github.com/electronstudio/raylib-python-cffi/issues/142")
|
||||||
print("Your Python is: "+str(sys.implementation)+"\n", file=sys.stderr)
|
logger.error("Your Python is: %s", str(sys.implementation))
|
||||||
raise
|
raise
|
||||||
|
|
||||||
from raylib._raylib_cffi.lib import *
|
from raylib._raylib_cffi.lib import *
|
||||||
from raylib.colors import *
|
from raylib.colors import *
|
||||||
from raylib.defines import *
|
from raylib.defines import *
|
||||||
import cffi
|
import cffi
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
||||||
print("RAYLIB STATIC "+__version__+" LOADED", file=sys.stderr)
|
logger.warning("RAYLIB STATIC %s LOADED", __version__)
|
||||||
|
|
||||||
|
|
Reference in a new issue