Click here to Skip to main content
12,253,990 members (64,880 online)
Click here to Skip to main content

Tagged as

Stats

33.2K views
115 downloads
24 bookmarked
Posted

An Introduction to Pantheios Back-ends, Part 1: The Back-end API

, 10 Sep 2008 BSD
An introduction to the Pantheios logging API library's Back-end API, along with a trivial example to illustrate the concepts
trivial_backend
vc6
trivial_backend.dsp
trivial_backend.vc6.dsw
/* /////////////////////////////////////////////////////////////////////////
 * File:        trivial_backend.c
 *
 * Purpose:     Implementation file for the trivial_backend project.
 *
 * Created:     9th September 2008
 * Updated:     9th September 2008
 *
 * Status:      Wizard-generated
 *
 * License:     (Licensed under the Synesis Software Open License)
 *
 *              Copyright (c) 2008, Synesis Software Pty Ltd.
 *              All rights reserved.
 *
 *              www:        http://www.synesis.com.au/software
 *
 * ////////////////////////////////////////////////////////////////////// */


/* Pantheios Header Files */
// file: hypothetical_backend.c
#include <pantheios/backend.h>
#include <pantheios/error_codes.h>

#include <stdio.h>
#include <string.h>

int pantheios_be_init(
  char const* processIdentity
, void*       reserved
, void**      ptoken
)
{
  *ptoken = strdup(processIdentity);
  return (NULL == *ptoken)
    ? PANTHEIOS_INIT_RC_OUT_OF_MEMORY
    : PANTHEIOS_INIT_RC_SUCCESS;
}

void pantheios_be_uninit(
  void* token
)
{
  free(token);
}

int pantheios_be_logEntry(
  void*       feToken
, void*       beToken
, int         severity
, char const* entry
, size_t      cchEntry
)
{
  char const* processIdentity = (char const*)beToken;
  fprintf(stdout, "%s[%d]: %.*s\n", processIdentity, severity, (int)cchEntry, entry);
  return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License

Share

About the Author

Matt (D) Wilson
Instructor / Trainer
Australia Australia
Software Development consultant, specialising in project remediation.

Creator of the FastFormat, Pantheios, STLSoft and VOLE open-source libraries.

Author of the books Extended STL, volume 1 (Addison-Wesley, 2007) and Imperfect C++ (Addison-Wesley, 2004).

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160426.1 | Last Updated 10 Sep 2008
Article Copyright 2008 by Matt (D) Wilson
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid