Creating of own output format
You can create your own output format in ISPmanager using the C++ programming language as follows:
- Install the developer package.
CentOS:Debian, Ubuntu:yum install coremanager-devel
apt-get install coremanager-devel
- Develop your module using the guidelines provided in Lower-level interaction, C++ plug-ins.
- Create a subclass that will inherit methods from the
OutputFormat
class. - Redefine the
Write
method. - To check, request the method with indication of the new format:
out=MyCustomFormat
.
Code example:
#include <api/output.h>
#include <mgr/mgrlog.h>
#include <api/module.h>
#include <api/connection.h>
MODULE("output");
namespace {
using namespace isp_api;
using namespace mgr_xml;
class OutputMyCustomFormat : public OutputFormat {
public:
OutputMyCustomFormat() : OutputFormat("MyCustomFormat") {}
virtual ~OutputMyCustomFormat() {}
virtual bool IsHtml() const { return true; }
virtual bool WantMessages() const { return true; }
virtual void Write(Connection &conn, Xml &xml)
const string output = "output" // here, using the xml received as input, you need to form the server response
conn.Output() << "\n" << output << std::endl;
}
};
MODULE_INIT(OutputMyCustomFormat, "") {
new OutputMyCustomFormat();
}
}