custom for >5 resources

Fork of mbedConnectorInterface by Doug Anson

api/Logger.cpp

Committer:
sam_grove
Date:
2015-01-27
Revision:
2:853f9ecc12df
Parent:
0:b438482ebbfc
Child:
5:a929d65eb385

File content as of revision 2:853f9ecc12df:

/**
 * @file    Logger.cpp
 * @brief   mbed CoAP Endpoint logging class
 * @author  Doug Anson/Chris Paola
 * @version 1.0
 * @see
 *
 * Copyright (c) 2014
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "Logger.h"

// Constructor
Logger::Logger(const BufferedSerial *pc)
{
    this->m_pc = (BufferedSerial *)pc;
}

// Copy Constructor
Logger::Logger(const Logger &logger)
{
    this->m_pc = logger.m_pc;
}

// Destructor
Logger::~Logger()
{
}

// Log output
void Logger::log(const char *format,...)
{
    va_list args;
    va_start(args,format);
    if (this->m_pc != NULL) {
        //this->m_pc->printf(format,args);
        //this->m_pc->printf("\r\n");
        std::printf(format,args);
        std::printf("\r\n");
    } else {
        std::printf(format,args);
        std::printf("\r\n");
    }
    va_end(args);
}