Export all Logs
Hello everbody, I got a small Problem. I tried to export all log in Categorys from one real Robot.
I treid to do this in C#, but it will not works. I would be need only the messages, Date, and stuff from the Log.
Later i will put this Stuff in a Database.
Any one do something like this?
Comments
-
You need to create an instance of EvetLog class and sign with the controller and EventLog properties of that controller.
After you need to create a new variable var and assign that newly created instants with GetCategories properties to that variable.
And use foreach to go through that variable and so on.
Example:
class ControllerLocater
{
private string outputLine = null;
public string OutputLine { get { return outputLine; } set { outputLine = value; } }
private string errorBody = null;
public string ErrorBody { get { return errorBody; } set { errorBody = value; } }
private string bodyText = null;
public string BodyText { get { return BodyText; } }
public void controllerOutput()
{
NetworkScanner ntScann = new NetworkScanner();
ntScann.Scan();
ControllerInfoCollection controllers = ntScann.Controllers;
Controller ctrl = ControllerFactory.CreateFrom(controllers[0]);
EventLog log = ctrl.EventLog;
var categories = log.GetCategories();
foreach (var c in categories)
{
for (int p = 0; p < c.Messages.Count; p++)
{
bodyText = c.Messages[p].Body;
// some text editing. Not complited – just as an exampl
TextEditor();
Console.WriteLine($"/nType of Log - {c.Type.ToString()}");
Console.WriteLine($"/n{errorBody}");
}
c.Dispose();
}
} // end of controllerOutput method
public string TextEditor()
{
outputLine = Regex.Replace(bodyText, "<.*?>", System.String.Empty);
//ar = Regex.Split(outputLine, pt);
//Console.ReadKey();
outputLine = Regex.Replace(outputLine, @\.(?! |$), ". ");
outputLine = outputLine.Replace("1)", "\n\n\bActions \n1) ");
outputLine = outputLine.Replace("2)", "\n2) ");
outputLine = outputLine.Replace("3)", "\n3) ");
errorBody = outputLine;
return errorBody;
} // end of TextEditor method
} // end of ControllerLocater class
0
Categories
- All Categories
- 5.5K RobotStudio
- 395 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings