Log message to chat logs

@param from    {string} - name of person sending the message
@param message {string} - the message sent
481437
function logChat(from, message) {
  if (typeof config.log !== 'string' || !from || typeof message !== 'string')
    return;

  // Get the current moment
  var now = moment();

  // Create the file name
  var file = path.join(config.log, now.format('YYYY-MM-DD') + '-' + 'chat.log');

  // Create the text to log based on moment and chat info
  var text = '[' + now.format('YYYY-MM-DD hh:mm A') + '] ' + from + ': ' + message + '\n';

  // Append the text to the log file
  fs.appendFile(file, text, function(err) {
    if (err)
      error(err);
  });
}
1090515
function(message, level) {
            level = level || Base.LOGLEVEL.INFO;

            if (message instanceof Error) {
                message = message.toString() + (message.stack || "");
            }

            if (Base.logger.length) {
                for (var i = 0; i < Base.logger.length; i++) {
                    Base.logger[i].log(message, level);
                }
            } else if (typeof console !== "undefined") {
                var method = (console[level] || console.log);
                if(method){
                    try {
                        method.call(console, "[ " + (new Date()) + " ]: ", message);
                    } catch (e) {
                        // nothing to do here
                    }
                }
            }
        }
800655
function log(...messages) {
  console.log(...messages);
  const p = document.createElement('p');
  p.innerText = messages.join(' ');
  logElement.appendChild(p);
}
255079
function (message) {
    var that = this;
    that._traceLogEventsCount();
    that.mc.trigger(TypeMsg$1.OnCreateError, message);
  }
509543
def msg(message):
    
    to_stdout(" --- {message}".format(message=message))
    if _logger:
        _logger.info(message)
289203
function _log(message) {
        var level = message.level;
        if (level === "warning") {
            level = "warn";
        }
        var text = "ConsoleAgent: " + message.text;
        if (message.url) {
            text += " (url: " + message.url + ")";
        }
        if (message.stackTrace) {
            var callFrame = message.stackTrace[0];
            text += " in " + callFrame.functionName + ":" + callFrame.columnNumber;
        }
        console[level](text);
    }
178684
function log(level, message) {
            var rawMessage = message;
            level = Level.toLevel(level);

            if (this.hasLevelGt(level)) {
                var args = argsToArray(arguments, 1);
                if (args.length > 1) {
                    message = format.apply(null, args);
                }
                if (Level.TRACE.equals(level)) {
                    var err = new Error;
                    err.name = "Trace";
                    err.message = message || '';
                    Error.captureStackTrace(err, log);
                    message = err.stack;
                } else if (Level.ERROR.equals(level) && isInstanceOf(message, Error)) {
                    message = message.stack;
                }
                var type = level.name.toLowerCase(), appenders = this.__appenders;
                var event = this.getLogEvent(level, message, rawMessage);
                Object.keys(appenders).forEach(function (i) {
                    appenders[i].append(event);
                });
            }
            return this;
        }
747936
public synchronized void logMessage(final Level level, final String message)
	{

		if (logLevel.toInt() > level.toInt()) {
			return;
		}

		try {
			this.writer.write(System.currentTimeMillis() + "\t" + consumerName
					+ " [" + type.toString() + "] " + "\t" + message + "\r\n");
			this.writer.flush();
		}
		catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}
1091363
function processMessage(message) {
      var recipients = Object.keys(message.recipient_status).filter(function(userId) {
        return hook.receipts.reportForStatus.indexOf(message.recipient_status[userId]) !== -1;
      });

      if (recipients.length) {
        var identities = [message.sender.user_id].concat(recipients);
        var identityHash = {};
        if (!hook.receipts.identities) {
          createJob(message, recipients, {});
        } else {
          if (!(hook.receipts.identities instanceof Function)) {
            hook.receipts.identities = getUserFromIdentities;
          }
          var getUser = hook.receipts.identities;
          var count = 0;
          identities.forEach(function(userId) {
            getUser(userId, function(err, data) {
              identityHash[userId] = data;
              count++;
              if (count === identities.length) createJob(message, recipients, identityHash);
            })
          });
        }
      }
    }
958279
function getLogEvent(level, message, rawMessage) {
            return {
                hostname: os.hostname(),
                pid: process.pid,
                gid: hasGetGid ? process.getgid() : null,
                processTitle: process.title,
                level: level,
                levelName: level.name,
                message: message,
                timeStamp: new Date(),
                name: this.fullName,
                rawMessage: rawMessage
            };
        }
1021450
function onMessage(message) {
    if (message.type != "utf8") return

    DEBUGMSG("recv: " + message.utf8Data)
    message = JSON.parse(message.utf8Data)

    if      (message.type == "request")  session.onRequest(channel, message)
    else if (message.type == "response") session.onResponse(channel, message)
    else if (message.type == "event")    session.onEvent(channel, message)
  }
1189921
public function onMessage(ConnectionInterface $from, $message)
    {
        $message = json_decode($message);

        // TODO: Various auth checks and safety. We don't want to try to handle anything/everything from the client!
        $channel = $message->message->channel;

        if ($message->event == 'subscribe') {
            // Tie the connection to the channel
            $this->subscribedTopics[$channel][] = $from;
        }
    }
1092072
function(message) {
    if (!_.isObject(message)) {
      message = {
        message: message
      };
    }

    try {
      message = JSON.stringify(_.defaultsDeep({}, message, this.config.defaultProps));
    } catch (e) {
      return this.logger.error('Logmatic - error while parsing log message. Not sending', e);
    }

    if (this.isConnected) {
      this.sendMessage(message);
    } else {
      this.messageBuffer.push(message);
    }
  }
132494
private Chat createChat(Message message) {
        Jid from = message.getFrom();
        // According to RFC6120 8.1.2.1 4. messages without a 'from' attribute are valid, but they
        // are of no use in this case for ChatManager
        if (from == null) {
            return null;
        }

        EntityJid userJID = from.asEntityJidIfPossible();
        if (userJID == null) {
            LOGGER.warning("Message from JID without localpart: '" + message.toXML() + "'");
            return null;
        }
        String threadID = message.getThread();
        if (threadID == null) {
            threadID = nextID();
        }

        return createChat(userJID, threadID, false);
    }
1321249
public void sendMessage(final String message) {
        try {
            session.sendMessage(new TextMessage(message));
        }
        catch (IOException e) {
            logger.error("[sendTextMessage]", e);
        }
    }
276354
public static void log (String message, Object... args)
    {
        StringBuilder sb = new StringBuilder();
        sb.append(message);
        if (args.length > 1) {
            sb.append(" [");
            for (int ii = 0, ll = args.length/2; ii < ll; ii++) {
                if (ii > 0) {
                    sb.append(", ");
                }
                sb.append(args[2*ii]).append("=").append(args[2*ii+1]);
            }
            sb.append("]");
        }
        Object error = (args.length % 2 == 1) ? args[args.length-1] : null;
        if (GWT.isScript()) {
            if (error != null) {
                sb.append(": ").append(error);
            }
            firebugLog(sb.toString(), error);
        } else {
            GWT.log(sb.toString(), (Throwable)error);
        }
    }
658725
public function send($message, $from, $color = null)
    {
        $data = [
            'room_id' => $this->name,
            'message' => $message,
            'from' => $from
        ];

        if ($color) {
            $data['color'] = $color;
        }

        $this->connection->write('/v1/rooms/message', $data);
    }