asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design
Examples

services::basic_logger< Service > Class Template Reference

Inherits noncopyable.

Collaboration diagram for services::basic_logger< Service >:

Collaboration graph
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 22 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 (asio::io_service &io_service, const std::string &identifier)
 Constructor.
 ~basic_logger ()
 Destructor.
asio::io_serviceio_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_typeservice_
 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 27 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 30 of file basic_logger.hpp.


Constructor & Destructor Documentation

template<typename Service>
services::basic_logger< Service >::basic_logger ( 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 40 of file basic_logger.hpp.

00043     : service_(asio::use_service<Service>(io_service)),
00044       impl_(service_.null())
00045   {
00046     service_.create(impl_, identifier);

template<typename Service>
services::basic_logger< Service >::~basic_logger (  ) 

Destructor.

Definition at line 49 of file basic_logger.hpp.

00051   {
00052     service_.destroy(impl_);


Member Function Documentation

template<typename Service>
asio::io_service& services::basic_logger< Service >::io_service (  ) 

Get the io_service associated with the object.

Definition at line 55 of file basic_logger.hpp.

00057   {
00058     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 61 of file basic_logger.hpp.

00063   {
00064     service_.use_file(impl_, file);

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

Log a message.

Definition at line 67 of file basic_logger.hpp.

Referenced by services::stream_socket_service< Protocol >::assign(), 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 >::at_mark(), services::stream_socket_service< Protocol >::available(), 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 >::is_open(), 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().

00069   {
00070     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 74 of file basic_logger.hpp.

template<typename Service>
impl_type services::basic_logger< Service >::impl_ [private]

The underlying native implementation.

Definition at line 77 of file basic_logger.hpp.


The documentation for this class was generated from the following file:
asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design