Jump to content
Korean Random
Helkar

фильтр лога

Recommended Posts

удаляет спам таких сообщений:

NOTICE: [NOTE] (scripts/client/Avatar.py, 1030): [INIT_STEPS] Avatar.vehicle_onEnterWorld

код мода:

filter_arr = [
'[INIT_STEPS]'
]

try:
    from ResMgr import resolveToAbsolutePath
    config_path = resolveToAbsolutePath('scripts/client/mods/log_filter.txt')
    with open(config_path) as config_file:
        for filter in config_file.read().splitlines():
            if filter:
                filter_arr.append(filter)
except:
    print 'log_filter: problem with config file, using default'

def clean_doLog(base, category, msg, args = None):
    for filter in filter_arr:
        if msg.find(filter) >= 0:
            return
    base(category, msg, args)

def _RegisterEvents():
    import debug_utils
    from xfw import OverrideMethod
    OverrideMethod(debug_utils, '_doLog', clean_doLog)

import BigWorld
BigWorld.callback(0, _RegisterEvents)

в прилагающемся текстовом файле можно задать дополнительный список текстов по которым будет производиться фильтрация.

для работы нужен XVM.

файлы ложить в res_mods\0.9.7\scripts\client\mods

log_filter.rar

 

Edited by Helkar
  • Upvote 7

Share this post


Link to post

Short link
Share on other sites

Well done.

 

How about exporting the filter to a customizable XML file and then let the script filter other types of log messages as well? E.g. a filter 'log_filter' will prevent 'INFO: Load mods: log_filter' from appearing in the log.

Share this post


Link to post

Short link
Share on other sites

Well done.

 

How about exporting the filter to a customizable XML file and then let the script filter other types of log messages as well? E.g. a filter 'log_filter' will prevent 'INFO: Load mods: log_filter' from appearing in the log.

i've updated the first post to support custom filtering.

however, the mod only filters what is written via this function: debug_utils._doLog, which meens such things 'INFO: Load mods: log_filter' will not by filtered

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

i've updated the first post to support custom filtering.

however, the mod only filters what is written via this function: debug_utils._doLog, which meens such things 'INFO: Load mods: log_filter' will not by filtered

Мод работает с последними версиями игры?

Share this post


Link to post

Short link
Share on other sites

Мод работает с последними версиями игры?

думаю да, а разве он еще актуален? вроде спама в лог уже нет.

Share this post


Link to post

Short link
Share on other sites

думаю да, а разве он еще актуален? вроде спама в лог уже нет.

выпадает редко 

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...