Sunday, September 27, 2015

Use of the showPlus format flag

Pantheios 1.0.1 beta 215 introduces the showPlus format flag, which causes leading pluses to be applied to integers (just as leading minuses will appear for negative numbers).

It is used as follows:

#include <pantheios/pan.hpp>
#include <pantheios/inserters/i.hpp>

int main()
{
  pan::log_INFORMATIONAL("log -10:");
  pan::log_INFORMATIONAL("without showPlus: '", pan::i(-10), "'");
  pan::log_INFORMATIONAL("with    showPlus: '", pan::i(-10, 0, pan::fmt::showPlus), "'");
  pan::log_INFORMATIONAL("----------\n");

  pan::log_INFORMATIONAL("log +10:");
  pan::log_INFORMATIONAL("without showPlus: '", pan::i(+10), "'");
  pan::log_INFORMATIONAL("with    showPlus: '", pan::i(+10, 0, pan::fmt::showPlus), "'");
  pan::log_INFORMATIONAL("----------\n");


  pan::log_INFORMATIONAL("log -10 into 10-width:");
  pan::log_INFORMATIONAL("without showPlus: '", pan::i(-10, 10, 0), "'");
  pan::log_INFORMATIONAL("with    showPlus: '", pan::i(-10, 10, pan::fmt::showPlus), "'");
  pan::log_INFORMATIONAL("----------\n");

  pan::log_INFORMATIONAL("log +10 into 10-width:");
  pan::log_INFORMATIONAL("without showPlus: '", pan::i(+10, 10, 0), "'");
  pan::log_INFORMATIONAL("with    showPlus: '", pan::i(+10, 10, pan::fmt::showPlus), "'");
  pan::log_INFORMATIONAL("----------\n");


  pan::log_INFORMATIONAL("log -10 into 10-width left-justified:");
  pan::log_INFORMATIONAL("without showPlus: '", pan::i(-10, -10, 0), "'");
  pan::log_INFORMATIONAL("with    showPlus: '", pan::i(-10, -10, pan::fmt::showPlus), "'");
  pan::log_INFORMATIONAL("----------\n");

  pan::log_INFORMATIONAL("log +10 into 10-width left-justified:");
  pan::log_INFORMATIONAL("without showPlus: '", pan::i(+10, -10, 0), "'");
  pan::log_INFORMATIONAL("with    showPlus: '", pan::i(+10, -10, pan::fmt::showPlus), "'");
  pan::log_INFORMATIONAL("----------\n");


  return 0;
}

PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.scratch.showPlus.integer");

which gives the output:

[test.scratch.showPlus.integer...]: log -10:
[test.scratch.showPlus.integer...]: without showPlus: '-10'
[test.scratch.showPlus.integer...]: with    showPlus: '-10'
[test.scratch.showPlus.integer...]: ----------

[test.scratch.showPlus.integer...]: log +10:
[test.scratch.showPlus.integer...]: without showPlus: '10'
[test.scratch.showPlus.integer...]: with    showPlus: '+10'
[test.scratch.showPlus.integer...]: ----------

[test.scratch.showPlus.integer...]: log -10 into 10-width:
[test.scratch.showPlus.integer...]: without showPlus: '       -10'
[test.scratch.showPlus.integer...]: with    showPlus: '       -10'
[test.scratch.showPlus.integer...]: ----------

[test.scratch.showPlus.integer...]: log +10 into 10-width:
[test.scratch.showPlus.integer...]: without showPlus: '        10'
[test.scratch.showPlus.integer...]: with    showPlus: '       +10'
[test.scratch.showPlus.integer...]: ----------

[test.scratch.showPlus.integer...]: log -10 into 10-width left-justified:
[test.scratch.showPlus.integer...]: without showPlus: '-10       '
[test.scratch.showPlus.integer...]: with    showPlus: '-10       '
[test.scratch.showPlus.integer...]: ----------

[test.scratch.showPlus.integer...]: log +10 into 10-width left-justified:
[test.scratch.showPlus.integer...]: without showPlus: '10        '
[test.scratch.showPlus.integer...]: with    showPlus: '+10       '
[test.scratch.showPlus.integer...]: ----------


GitHub access

Pantheios GitHub access now at:




Fork away!

Pantheios 1.0.1 beta 215 released

Pantheios is an open source C/C++ Logging API library, offering an optimal
combination of 100% type-safety, efficiency, genericity and extensibility.
It is simple to use and extend, highly-portable (platform and
compiler-independent) and, best of all, it upholds the C tradition of you
only pay for what you use.

Pantheios supports logging of message statements of arbitrary complexity,
consisting of heterogeneous types.

Pantheios supports filtering of log messages based on severity level
including (but not limited to) the eight levels defined by the SysLog
protocol.

Pantheios supports back-end output, individually and in combination, to
stderr/stdout, SysLog (including a custom implementation of the SysLog
protocol for Windows), Windows debugger, Windows event log, COM Error
Object, Speech, or any custom back-end extension you care to write.
Importantly, Pantheios is readily extended to use the existing transport
mechanisms of feature-rich logging libraries such as ACE, log4cpp,
log4cplus, log4cxx.

Pantheios does not contain any compiler-specific or platform-specific
constructs. It supports UNIX (including Linux and Mac OS-X), and Windows,
and should work with any operating system. It is known to be compatible with
Borland (5.6+), Clang, Comeau (4.3.3+), Digital Mars (8.45+), GCC (3.4+), Intel
(7+), Metrowerks (8+), Microsoft Visual C++ (6.0+), and should work with any
reasonably modern C++ compiler.

Pantheios is completely free and includes source released under a BSD-style
license. Commercial servics, including bespoke customisations, are available
from Synesis Software Pty Ltd; http://synesis.com.au/contact.html

Pantheios Training is provided by Synesis Software Pty Ltd; details at
http://synesis.com.au/training.html

Release 1.0.1 beta 215 incorporates:
* added interval inserter
* added stream_character inserter
* Clang-compatibility
* VC++ 11-compatibility
* VC++ 12-compatibility
* VC++ 14-compatibility
* showPlus format flag support in pantheios::integer (pan::i)
* makefiles customisable to specify non-bundled locations of b64, shwild,
xContract, xCover, and xTests libraries (useful to getting head from GitHub)
* NOTE: Now requires STLSoft 1.9.121


Download from:
https://sourceforge.net/projects/pantheios/files/Pantheios%20%28C%20and%20Cxx%29/

Discuss at: https://sourceforge.net/projects/pantheios/forums/forum/475313

Pantheios website: http://pantheios.org/

Note: this release of Pantheios requires STLSoft 1.9.121, or later; download
from http://stlsoft.org/