# Path: log.py
# def info(s, color=''):
# def warning(s):
# def debug(s):
# def error(s, need_exc_info=False, fatal=False):
# def initLogDir():
# def write(log, s):


import time
import cache
import vkapi
from log import datetime_format
        m = msg['message']
        if 'chat_id' in m:
            print('Chat "{}" ({}): {}'.format(cc[m['chat_id']]['title'], m['chat_id'], msg['unread']))
        else:
            print('{} {} ({}){}: {}'.format(uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name'], m['user_id'],
                  ', online' if uc[m['user_id']]['online'] else '', msg['unread']))
        print()
        for i in messages[vkapi.utils.getSender(msg['message'])]:
            if 'attachments' in i:
                for a in i['attachments']:
                    if a['type'] == 'photo':
                        max_photo = max(a['photo']['sizes'], key=lambda x: x['width'])
                        i['body'] += ' (' + max_photo['url'] + ')'
            print('[{}] {}'.format(time.strftime(datetime_format, time.localtime(i['date'])), i['body']))
            print()
            if 'chat_id' not in m:
                mids.append(i['id'])
        print('-------------------------\n')

    if 't' in args:
        print(flush=True)
        mr = vkapi.MessageReceiver(a)
        while True:
            time.sleep(1)
            for m in mr.getMessages():
                if 'chat_id' in m:
                    print('Chat "{}" ({}), {} {}:'.format(cc[m['chat_id']]['title'], m['chat_id'],
                                                          uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name']))
                else:
                    print('{} {} ({}):'.format(uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name'], m['user_id']))

# Path: log.py
# def info(s, color=''):
# def warning(s):
# def debug(s):
# def error(s, need_exc_info=False, fatal=False):
# def initLogDir():
# def write(log, s):


# Path: scripts/read.py
import time
import cache
import vkapi
from log import datetime_format

        m = msg['message']
        if 'chat_id' in m:
            print('Chat "{}" ({}): {}'.format(cc[m['chat_id']]['title'], m['chat_id'], msg['unread']))
        else:
            print('{} {} ({}){}: {}'.format(uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name'], m['user_id'],
                  ', online' if uc[m['user_id']]['online'] else '', msg['unread']))
        print()
        for i in messages[vkapi.utils.getSender(msg['message'])]:
            if 'attachments' in i:
                for a in i['attachments']:
                    if a['type'] == 'photo':
                        max_photo = max(a['photo']['sizes'], key=lambda x: x['width'])
                        i['body'] += ' (' + max_photo['url'] + ')'
            print('[{}] {}'.format(time.strftime(datetime_format, time.localtime(i['date'])), i['body']))
            print()
            if 'chat_id' not in m:
                mids.append(i['id'])
        print('-------------------------\n')

    if 't' in args:
        print(flush=True)
        mr = vkapi.MessageReceiver(a)
        while True:
            time.sleep(1)
            for m in mr.getMessages():
                if 'chat_id' in m:
                    print('Chat "{}" ({}), {} {}:'.format(cc[m['chat_id']]['title'], m['chat_id'],
                                                          uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name']))
                else:
                    print('{} {} ({}):'.format(uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name'], m['user_id']))

                print('[{}] {}'.format(time.strftime(datetime_format, time.localtime(m['date'])), m['body']))