<commit_before># coding=utf-8
from logging import getLogger, FileHandler, Formatter, INFO
from os import environ

from bcrypt import checkpw

logFilePath = '/var/log/myvpn/OpenVPN-Auth.log'

Username = environ['username']
Password = environ['password']

logger = getLogger( 'OpenVPN-Auth' )
hdlr = FileHandler( logFilePath )
formatter = Formatter( '%(asctime)s %(levelname)s %(message)s' )
hdlr.setFormatter( formatter )
logger.addHandler( hdlr )
logger.setLevel( INFO )

try:

    with open( "user.data" ) as f:
        data = f.readlines()

    for line in data:
        words = line.split( ":" )
        if words[0][0] == '#':
            continue
        else:
            if words[0] == Username:
                if checkpw( Password.encode(), words[1].encode() ):
                    logger.info( "User: " + words[0] + " - Sucessfully Authenticated" )
                    exit( 0 )
                else:
                    logger.warning("User: "+words[0]+" - Password Did not Match" )
                    exit( 1 )

    logger.warning( "User: " + Username + " - User not Found" )
    exit( 1 )

except Exception as e:
    logger.critical(str(e))
    exit(1)<commit_msg>changed logging to write in terminal<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import logging
from os import environ
from bcrypt import checkpw

logFilePath = '/var/log/myvpn/auth.log'

Username = environ['username']
Password = environ['password']

logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',level=logging.INFO)

try:

    with open( "user.data" ) as f:
        lines = f.read().splitlines()

    for line in lines:
        words = line.split( ":" )
        if words[0][0] == '#':
            continue
        if words[0] != '' and words[1] != '' and words[0][0] != ' ' and words[1][0] != ' ':
            if words[0] == Username:
                if checkpw( Password.encode(), words[1].encode() ):
                    logging.info( "User: " + words[0] + " - Sucessfully Authenticated" )
                    exit( 0 )
                else:
                    logging.warning("User: "+words[0]+" - Password Did not Match" )
                    exit( 1 )

    logging.warning( "User: " + Username + " - User not Found" )
    exit( 1 )

except Exception as e:
    logging.critical(str(e))
    exit(1)
{'fraction_non_alphanumeric': 0.14754098360655737, 'fraction_numerical': 0.012510785159620362, 'mean_word_length': 2.2343096234309625, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '5223825', 'n_tokens_mistral': 749, 'n_tokens_neox': 721, 'n_words': 184}