| Home | Libraries | People | FAQ | More

# services::basic_logger< Service > Class Template Reference

Inherits noncopyable.

Collaboration diagram for services::basic_logger< Service >:

List of all members.

## Detailed Description

### template<typename Service>
class services::basic_logger< Service >

Class to provide simple logging functionality. Use the services::logger typedef.

Definition at line 12 of file basic_logger.hpp.

## Public Types

typedef Service | service_type
| The type of the service that will be used to provide timer operations.
typedef service_type::impl_type | impl_type
| The native implementation type of the timer.

## Public Member Functions

| basic_logger (boost::asio::io_service &io_service, const std::string &identifier)
| Constructor.
| ~basic_logger ()
| Destructor.
boost::asio::io_service & | io_service ()
| Get the io_service associated with the object.
void | use_file (const std::string &file)
| Set the output file for all logger instances.
void | log (const std::string &message)
| Log a message.

## Private Attributes

service_type & | service_
| The backend service implementation.
impl_type | impl_
| The underlying native implementation.

## Member Typedef Documentation

template<typename Service>

typedef Service services::basic_logger< Service >::service_type

The type of the service that will be used to provide timer operations.

Definition at line 17 of file basic_logger.hpp.

template<typename Service>

typedef service_type::impl_type services::basic_logger< Service >::impl_type

The native implementation type of the timer.

Definition at line 20 of file basic_logger.hpp.

## Constructor & Destructor Documentation

template<typename Service>

services::basic_logger< Service >::basic_logger | ( | boost::asio::io_service & | io_service,
|  | const std::string & | identifier |
| ) |  |  | `[explicit]`

Constructor.

This constructor creates a logger.

Parameters:

  | io_service | The io_service object used to locate the logger service.
  | identifier | An identifier for this logger.

Definition at line 30 of file basic_logger.hpp.

    00033     : service_(boost::asio::use_service<Service>(io_service)),
    00034       impl_(service_.null())
    00035   {
    00036     service_.create(impl_, identifier);

template<typename Service>

services::basic_logger< Service >::~basic_logger | ( |  | ) |

Destructor.

Definition at line 39 of file basic_logger.hpp.

    00041   {
    00042     service_.destroy(impl_);

## Member Function Documentation

template<typename Service>

boost::asio::io_service& services::basic_logger< Service >::io_service | ( |  | ) |

Get the io_service associated with the object.

Definition at line 45 of file basic_logger.hpp.

    00047   {
    00048     return service_.io_service();

template<typename Service>

void services::basic_logger< Service >::use_file | ( | const std::string & | file | ) |

Set the output file for all logger instances.

Definition at line 51 of file basic_logger.hpp.

    00053   {
    00054     service_.use_file(impl_, file);

template<typename Service>

void services::basic_logger< Service >::log | ( | const std::string & | message | ) |

Log a message.

Definition at line 57 of file basic_logger.hpp.

Referenced by services::stream_socket_service< Protocol >::async_connect(), services::stream_socket_service< Protocol >::async_receive(), services::stream_socket_service< Protocol >::async_send(), services::stream_socket_service< Protocol >::bind(), services::stream_socket_service< Protocol >::close(), services::stream_socket_service< Protocol >::connect(), services::stream_socket_service< Protocol >::get_option(), services::stream_socket_service< Protocol >::io_control(), services::stream_socket_service< Protocol >::local_endpoint(), services::stream_socket_service< Protocol >::open(), services::stream_socket_service< Protocol >::receive_handler< Handler >::operator()(), services::stream_socket_service< Protocol >::send_handler< Handler >::operator()(), services::stream_socket_service< Protocol >::connect_handler< Handler >::operator()(), services::stream_socket_service< Protocol >::receive(), services::stream_socket_service< Protocol >::remote_endpoint(), services::stream_socket_service< Protocol >::send(), services::stream_socket_service< Protocol >::set_option(), and services::stream_socket_service< Protocol >::shutdown().

    00059   {
    00060     service_.log(impl_, message);

## Member Data Documentation

template<typename Service>

service_type& services::basic_logger< Service >::service_ `[private]`

The backend service implementation.

Definition at line 64 of file basic_logger.hpp.

template<typename Service>

impl_type services::basic_logger< Service >::impl_ `[private]`

The underlying native implementation.

Definition at line 67 of file basic_logger.hpp.

The documentation for this class was generated from the following file:

- services/basic_logger.hpp

| Copyright © 2003 - 2006 Christopher M. Kohlhoff