What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Beginner Question: Is everyone using Log() to test what a method returns or other?

Myster2

New Member
Joined
Aug 18, 2015
Messages
26
Reaction score
0
For example i want to play around with the open auction plugin. I believe i understand it pretty well but I want to check and see exactly what getAuctionBuyList() is returning based on the different parameters. Would i just do something like

Code:
List<AuctionItem> items = getAuctionBuyList(req, 9);
 foreach (AuctionItem item in items) {
log(item);
}

Or is there another way you are outputting a large amount of data so you can view it?
 
I use log() to display small amounts of data, or write it to a text file if there is a lot of data or I want to review it later

Code:
List<AuctionItem> items = getAuctionBuyList(req, 9);

string[] lines = new string[items.Count];
foreach (AuctionItem i in items)
{
       lines[i] = items[i].ToString();
}

 try
{
       System.IO.File.WriteAllLines(Application.StartupPath + "\\Plugins\\MyPlugin\\AuctionData.txt", lines);
}
catch (Exception err)
{
       core.Log("Error Writing file : " + err.ToString());
}
 
I use log() to display small amounts of data, or write it to a text file if there is a lot of data or I want to review it later

Code:
List<AuctionItem> items = getAuctionBuyList(req, 9);

string[] lines = new string[items.Count];
foreach (AuctionItem i in items)
{
       lines[i] = items[i].ToString();
}

 try
{
       System.IO.File.WriteAllLines(Application.StartupPath + "\\Plugins\\MyPlugin\\AuctionData.txt", lines);
}
catch (Exception err)
{
       core.Log("Error Writing file : " + err.ToString());
}



does not work, a lot of mistakes:

// Name "req" is absent in the current context
 
Last edited:
I just quickly changed a code sample without testing it. 'req' is a variable used by Myster2

Code:
public List<AuctionItem> getAuctionBuyList(
	AuctionRequestParams requestParams,
	int maxCount
)

The orig code I used takes all the entries from a forms listbox and writes them to a text file.

Code:
private void button10_Click(object sender, EventArgs e)
{
       string[] lines = new string[listBox1.Items.Count];
       for (int i = 0; i < listBox1.Items.Count; i++)
       {
             lines[i] = listBox1.Items[i].ToString();
       }

      try
      {
           System.IO.File.WriteAllLines(@"WriteLines.txt", lines);
      }
      catch (Exception err)
      {
           core.Log("Error Writing file : " + err.ToString());
      }
}
 
Last edited:
For example i want to play around with the open auction plugin. I believe i understand it pretty well but I want to check and see exactly what getAuctionBuyList() is returning based on the different parameters. Would i just do something like

Code:
List<AuctionItem> items = getAuctionBuyList(req, 9);
 foreach (AuctionItem item in items) {
log(item);
}

Or is there another way you are outputting a large amount of data so you can view it?

Log save all strings in memory and sometimes cause a memory overload, so for large amount of data use a txt output or clear your log everytime after function output.
 
Back
Top