def filter(self, record):
request = get_request()<EOL>if request:<EOL><INDENT>user = getattr(request, '<STR_LIT:user>', None)<EOL>if user and not user.is_anonymous():<EOL><INDENT>record.username = user.username<EOL><DEDENT>else:<EOL><INDENT>record.username = '<STR_LIT:->'<EOL><DEDENT>meta = getattr(request, '<STR_LIT>', {})<EOL>record.remote_addr = meta.get('<STR_LIT>', '<STR_LIT:->')<EOL>record.http_user_agent = meta.get('<STR_LIT>', '<STR_LIT:->')<EOL>if not hasattr(record, '<STR_LIT>'):<EOL><INDENT>record.request = request<EOL><DEDENT><DEDENT>else:<EOL><INDENT>record.username = '<STR_LIT:->'<EOL>record.remote_addr = '<STR_LIT:->'<EOL>record.http_user_agent = '<STR_LIT:->'<EOL><DEDENT>return True<EOL>
Adds user and remote_addr to the record.