Source files are best viewed thanks to any text editor which is at least 100 character wide, set so that a tabulation is four character long. Ex: nedit, which can be launched thanks to nc
(or neditc
, or nedit-nc
depending on the distribution), to avoid wasting too much memory.
See our nedit configuration file, which we recommend to view our source code (one can put its content into ~/.nedit/nedit.rc
to have it taken into account). One can use too our script called n, that allows to edit files with great simplicity.
main()
function, one shall mimic the standard way of using it:
#include <iostream> // for cerr, endl
#include <exception>
#include <string>
using std::string ;
#include "Ceylan.h"
using namespace Ceylan ;
using namespace Ceylan::Log ;
/**
* What my program does.
*
*/
int main( int argc, char * argv[] )
{
LogHolder logger( argc, argv ) ;
try
{
LogPlug::info( "Starting my program" ) ;
// Blah blah blah
LogPlug::info( "End of my program." ) ;
}
catch ( const Ceylan::Exception & e )
{
std::cerr << "Ceylan exception caught: "
<< e.toString( Ceylan::high ) << std::endl ;
return Ceylan::ExitFailure ;
}
catch ( const std::exception & e )
{
std::cerr << "Standard exception caught: "
<< e.what() << std::endl ;
return Ceylan::ExitFailure ;
}
catch ( ... )
{
std::cerr << "Unknown exception caught" << std::endl ;
return Ceylan::ExitFailure ;
}
return Ceylan::ExitSuccess ;
}
trackInstance
is true or not specified in Ceylan::Object's constructor call), and if it does not send explicitly messages in its life (using the send
method), its name will be mangled in log aggregations. The reason for the mangling is that trackInstance
will cause two log messages to be sent (thus the channel will be created), but one will be sent from the object's constructor, the other from the destructor. In these two cases, compilers like gcc will return mangled names for one's instance class name (such as sonata/PID-12363/N6Ceylan6ObjectE/0xbffff020)
, which would have been automagically corrected by a Ceylan smart aggregator if a classical message had be sent.
LogHolder
(which is the recommended way of using the log system), one has often a favorite log plug (generally, the HTML one) which is a bit painful to specify each time (for example by adding --HTMLPlug
on the command line), so that the default plug, which is the classical (raw) one, is overriden. A convenient trick is to set an environment variable in your shell settings to define your plug (bash example: export PLUG="--HTMLPlug"
), and use it accordingly: ./testObject.exe $PLUG
.
If you have information more detailed or more recent than those presented in this document, if you noticed errors, neglects or points insufficiently discussed, drop us a line!