+1 vote
by (370 points)
edited

G'morning All,

I have a telnet session started where I specify a FileLogWriter, like so:

telnet = new Telnet(aixServerName, port);
telnet.LogWriter = new Rebex.FileLogWriter("./MyLog.log", Rebex.LogLevel.Verbose);
vt = telnet.StartVirtualTerminal();

Can I manually write my own messages to this log file ? If so, how ?

Thanks !

Chew

2 Answers

0 votes
by (370 points)
edited

I figured this out.

telnet.LogWriter.Write(Rebex.LogLevel.Info, null, 0, string.Empty, "Didn't Find the Expected Response: >|$ Prompt");

Thanks !

Chew

0 votes
by (58.9k points)
edited

Hello,

yes it is possible to write your own messages into the log file.

var client = new Telnet(server, port);
client.LogWriter = new Rebex.FileLogWriter("MyLog.log", Rebex.LogLevel.Verbose);

// you can write custom messages to the log using the LogWriter.Write method like this:
int instanceID;
client.LogWriter.Write(Rebex.LogLevel.Debug, typeof(Imap), instanceID, "MyArea", "MyMessage");

If you have just one instance of Telnet, just use instanceID = 0. If you are using multiple instances, you can use different instanceID's to differentiate it in the log file.

...