Refer to the Logging Example.
#include <cadex/Base_Logger.hxx>
#include <cadex/Base_LoggerFileAppender.hxx>
#include <cadex/Base_LoggerStreamAppender.hxx>
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData_ModelReader.hxx>
#include <iostream>
#include "../../cadex_license.cxx"
int main (int argc, char *argv[])
{
auto aKey = LicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate CAD Exchanger license." << endl;
return 1;
}
aLogger.
Register (aStreamAppender, Base_Logger::Error, Base_Logger::Fatal);
aLogger.
Register (aFileAppender, Base_Logger::Trace, Base_Logger::Fatal);
if (argc != 2) {
cerr << "Usage: " << argv[0] << " <input_file>, where:" << endl;
cerr << " <input_file> is a name of the .sat file to be read" << endl;
return 1;
}
const char* aSource = argv[1];
if (!aReader.
Read (aSource, aModel)) {
cerr << "Failed to open and convert the file " << aSource << endl;
return 1;
}
return 0;
}
Provides a logger that accepts and dispatches logging messages.
Definition: Base_Logger.hxx:34
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:40
Reads any format that CAD Exchanger can import.
Definition: ModelData_ModelReader.hxx:31
bool Read(const Base_UTF16String &theFilePath, ModelData_Model &theModel)
Reads the file at the specified path into the specified model.
Definition: ModelData_ModelReader.cxx:120
Provides logging messages in the stream.
Definition: Base_LoggerStreamAppender.hxx:29
bool ImmediateFlush() const
Returns true if each message must be flushed into the stream.
Definition: Base_LoggerStreamAppender.cxx:94
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22
Defines classes, types, and global functions related to standard C++ library.
void Register(Base_LoggerAppender &theAppender, const Level theMinLevel=Trace, const Level theMaxLevel=Fatal)
Adds an appender to the logger.
Definition: Base_Logger.cxx:210
Provides logging messages in the file.
Definition: Base_LoggerFileAppender.hxx:26