Logs a message with the specified level and tag. Messages are buffered and flushed when queue size exceeds limit.