Logs an entry to admin logs of model(s).
    :param instances: Model instance or list of instances
    :param msg: Message to log
    :param who: Who did the change
    :param kw: Optional key-value attributes to append to message
    :return: None
554995
def admin_log(instances, msg: str, who: User=None, **kw):
    

    from django.contrib.admin.models import LogEntry, CHANGE
    from django.contrib.admin.options import get_content_type_for_model
    from django.utils.encoding import force_text

    # use system user if 'who' is missing
    if not who:
        username = settings.DJANGO_SYSTEM_USER if hasattr(settings, 'DJANGO_SYSTEM_USER') else 'system'
        who, created = User.objects.get_or_create(username=username)

    # append extra keyword attributes if any
    att_str = ''
    for k, v in kw.items():
        if hasattr(v, 'pk'):  # log only primary key for model instances, not whole str representation
            v = v.pk
        att_str += '{}={}'.format(k, v) if not att_str else ', {}={}'.format(k, v)
    if att_str:
        att_str = ' [{}]'.format(att_str)
    msg = str(msg) + att_str

    if not isinstance(instances, list) and not isinstance(instances, tuple):
        instances = [instances]
    for instance in instances:
        if instance:
            LogEntry.objects.log_action(
                user_id=who.pk,
                content_type_id=get_content_type_for_model(instance).pk,
                object_id=instance.pk,
                object_repr=force_text(instance),
                action_flag=CHANGE,
                change_message=msg,
            )
112927
def log(message, level="info"):
    
    now = time.time()
    entry = {}
    entry['level'] = level
    entry['message'] = message
    entry['timestamp'] = now
    _log_entries.append(entry)
300865
def check_new_messages(client_id):
    
    # Return if driver is not defined or if whatsapp is not logged in.
    # Stop the timer as well
    if client_id not in drivers or not drivers[client_id] or not drivers[client_id].is_logged_in():
        timers[client_id].stop()
        return

    # Acquire a lock on thread
    if not acquire_semaphore(client_id, True):
        return

    try:
        # Get all unread messages
        res = drivers[client_id].get_unread()
        # Mark all of them as seen
        for message_group in res:
            message_group.chat.send_seen()
        # Release thread lock
        release_semaphore(client_id)
        # If we have new messages, do something with it
        if res:
            print(res)
    except:
        pass
    finally:
        # Release lock anyway, safekeeping
        release_semaphore(client_id)
735532
def warn(self, message, *args, **kwargs):
        
        self._log(logging.WARNING, message, *args, **kwargs)
847225
def action_log_delete(sender, instance, **kwargs):
    
    if instance.pk is not None:
        changes = model_instance_diff(instance, None)

        log_entry = LogAction.objects.create_log_action(
            instance=instance,
            action=LogAction.DELETE,
            changes=json.dumps(changes),
        )
871563
def info(self, msg: str) -> None:
        
        # noinspection PyUnresolvedReferences
        servicemanager.LogInfoMsg(str(msg))
        if self.debugging:
            log.info(msg)
923805
def logtrace(logger, msg, *args, **kwargs):
    '''
    
    '''
    if esgfpid.defaults.LOG_TRACE_TO_DEBUG:
        logdebug(logger, '[trace] %s' % msg, *args, **kwargs)
    else:
        pass
68031
def log_message(self, format, *args):
        
        self.log(format, args, logging.INFO)
1146142
def message(self, msg):
        
        for broker in self.message_brokers:
            try:
                broker(msg)
            except Exception as exc:
                utils.error(exc)
699168
def log(self, msg, level=INFO):
        
        logger.log(level, '<{}> - '.format(self._name) + msg)
1053557
async def on_raw_join(self, message):
        
        await super().on_raw_join(message)
        nick, metadata = self._parse_user(message.source)
        channels = message.params[0].split(',')

        if self.is_same_nick(self.nickname, nick):
            # We joined.
            if 'WHOX' in self._isupport and self._isupport['WHOX']:
                # Get more relevant channel info thanks to WHOX.
                await self.rawmsg('WHO', ','.join(channels), '%tnurha,{id}'.format(id=WHOX_IDENTIFIER))
        else:
            # Find account name of person.
            pass
551340
public static Messager instance0(Context context) {
        Log instance = context.get(logKey);
        if (instance == null || !(instance instanceof Messager))
            throw new InternalError("no messager instance!");
        return (Messager)instance;
    }
637782
def populate_instance(msg, inst):
    
    return _to_inst(msg, type(inst).__name__, type(inst).__name__, inst)
169074
def log(msg, *args, **kwargs):
    
    if len(args) == 0 and len(kwargs) == 0:
        print(msg)
    else:
        print(msg.format(*args, **kwargs))
25954
def log(cls, message):
        
        if cls.verbose > 0:
            msg = '[INFO] %s' % message
            cls.echo(msg)
796678
def debug(self, msg=None, *args, **kwargs):
        

        return self._log(logging.DEBUG, msg, args, kwargs)
479421
def on_raw_421(self, message):
        
        if message.params[1] in {'WHO', 'WHOIS'}:
            LOGGER.debug('Pydle sent WHO/WHOIS which resulted in 421')
        else:
            super().on_raw_421(message)