<commit_before>import logging as log
cimport c_opengl as cgl

cdef extern from *:
    ctypedef char* const_char_ptr "const char*"

cdef extern from 'GL/glew.h':
    const GLubyte* gluErrorString(GLenum error);

class bcolors:
    YELLOW = '\x1b[33m'
    RED = '\x1b[31m'
    END = '\x1b[0m'

def printWarn(string, color=bcolors.YELLOW):
    log.debug(color + string + color)

cdef print_error():
    code = cgl.glGetError()
    cdef char* c_char = <char*> gluErrorString(code)
    cdef bytes pyString = c_char

    if code:
        log.error(" *** Error *** [{}] {}".format(pyString, code) + bcolors.RED)

cdef void   glActiveTexture (GLenum texture) with gil:
    printWarn("GL glActiveTexture( texture = " + str(texture) + ", )")
    cgl.glActiveTexture ( texture)
    print_error()

cdef void   glAttachShader (GLuint program, GLuint shader) with gil:
    printWarn("GL glAttachShader( program = " + str(program) + ", shader = " + str(shader) + ",)")
    cgl.glAttachShader ( program, shader)
    print_error()
    
cdef void   glBindAttribLocation (GLuint program, GLuint index,  GLchar* name) with gil:
    printWarn("GL glBindAttribLocation( program = " + str(program) + ", index = " + str(index) + ", name*=" + str(repr(hex(<long> name))) + ", )")
    cgl.glBindAttribLocation ( program, index, name)
    print_error()
    
cdef void   glBindBuffer (GLenum target, GLuint buffer) with gil:
    printWarn("GL glBindBuffer( target = " + str(target) + ", buffer = " + str(buffer) + ", )")
    cgl.glBindBuffer ( target, buffer)
    print_error()
    
cdef void   glBindFramebuffer (GLenum target, GLuint framebuffer) with gil:
    printWarn("GL glBindFramebuffer( target = " + str(target) + ", framebuffer = " + str(framebuffer) + ", )")
    cgl.glBindFramebuffer ( target, framebuffer)
    print_error()
    
cdef void   glBindRenderbuffer (GLenum target, GLuint renderbuffer) with gil:
    printWarn("GL glBindRenderbuffer( target = " + str(target) + ", renderbuffer = " + str(renderbuffer) + ", )")
    cgl.glBindRenderbuffer ( target, renderbuffer)<commit_msg>Fix logging color as flagged by @jabooth<commit_after>import logging as log
cimport c_opengl as cgl

cdef extern from *:
    ctypedef char* const_char_ptr "const char*"

cdef extern from 'GL/glew.h':
    const GLubyte* gluErrorString(GLenum error);

class bcolors:
    YELLOW = '\x1b[33m'
    RED = '\x1b[31m'
    END = '\x1b[0m'

def printWarn(string, color=bcolors.YELLOW):
    log.debug(color + string + bcolors.END)

cdef print_error():
    code = cgl.glGetError()
    cdef char* c_char = <char*> gluErrorString(code)
    cdef bytes pyString = c_char

    if code:
        log.error(bcolors.RED + " *** Error *** [{}] {}".format(pyString, code) + bcolors.END)

cdef void   glActiveTexture (GLenum texture) with gil:
    printWarn("GL glActiveTexture( texture = " + str(texture) + ", )")
    cgl.glActiveTexture ( texture)
    print_error()

cdef void   glAttachShader (GLuint program, GLuint shader) with gil:
    printWarn("GL glAttachShader( program = " + str(program) + ", shader = " + str(shader) + ",)")
    cgl.glAttachShader ( program, shader)
    print_error()
    
cdef void   glBindAttribLocation (GLuint program, GLuint index,  GLchar* name) with gil:
    printWarn("GL glBindAttribLocation( program = " + str(program) + ", index = " + str(index) + ", name*=" + str(repr(hex(<long> name))) + ", )")
    cgl.glBindAttribLocation ( program, index, name)
    print_error()
    
cdef void   glBindBuffer (GLenum target, GLuint buffer) with gil:
    printWarn("GL glBindBuffer( target = " + str(target) + ", buffer = " + str(buffer) + ", )")
    cgl.glBindBuffer ( target, buffer)
    print_error()
    
cdef void   glBindFramebuffer (GLenum target, GLuint framebuffer) with gil:
    printWarn("GL glBindFramebuffer( target = " + str(target) + ", framebuffer = " + str(framebuffer) + ", )")
    cgl.glBindFramebuffer ( target, framebuffer)
    print_error()
    
cdef void   glBindRenderbuffer (GLenum target, GLuint renderbuffer) with gil:
    printWarn("GL glBindRenderbuffer( target = " + str(target) + ", renderbuffer = " + str(renderbuffer) + ", )")
    cgl.glBindRenderbuffer ( target, renderbuffer)
{'fraction_non_alphanumeric': 0.13578771216830027, 'fraction_numerical': 0.0038250059765718384, 'mean_word_length': 3.836994219653179, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4202951', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1425, 'n_words': 349}