Skip to content

Instantly share code, notes, and snippets.

@carlosvin
Created February 25, 2015 19:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosvin/ba77ab007fafacc32e7f to your computer and use it in GitHub Desktop.
Save carlosvin/ba77ab007fafacc32e7f to your computer and use it in GitHub Desktop.
First Biicode project with Poco
# Biicode configuration file
[requirements]
fenix/poco(develop): 0
[parent]
carlosvin/bii_log: 0
[includes]
Poco/Net/*.h: fenix/poco/Net/include
Poco/*.h: fenix/poco/Foundation/include
PROJECT( bii_log )
cmake_minimum_required(VERSION 3.0)
# inclusion of general biicode macros, biicode.cmake
set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake"
"${CMAKE_HOME_DIRECTORY}/../blocks"
"${CMAKE_HOME_DIRECTORY}/../deps")
INCLUDE(biicode.cmake)
ADD_DEFINITIONS(-DBIICODE)
SET(BIICODE_ENV_DIR /home/carlos/.biicode)
#artifact to allow upstream configurations
BII_PREBUILD_STEP(deps/zlib/zlib)
BII_PREBUILD_STEP(deps/fenix/poco)
BII_PREBUILD_STEP(blocks/carlosvin/bii_log)
enable_testing()
# Inclusion of the blocks affected by the build
BII_INCLUDE_BLOCK(deps/zlib/zlib)
BII_INCLUDE_BLOCK(deps/fenix/poco)
BII_INCLUDE_BLOCK(blocks/carlosvin/bii_log)
#include "Poco/FileChannel.h"
#include "Poco/FormattingChannel.h"
#include "Poco/PatternFormatter.h"
#include "Poco/Logger.h"
#include "Poco/AutoPtr.h"
using Poco::FileChannel;
using Poco::FormattingChannel;
using Poco::PatternFormatter;
using Poco::Logger;
using Poco::AutoPtr;
int main(int argc, char** argv) {
AutoPtr<FileChannel> pChannel(new FileChannel);
pChannel->setProperty("path", "log/sample.log");
pChannel->setProperty("rotation", "100 K");
pChannel->setProperty("archive", "timestamp");
//AutoPtr<ConsoleChannel> pCons(new ConsoleChannel);
AutoPtr<PatternFormatter> pPF(new PatternFormatter);
pPF->setProperty("pattern", "%Y-%m-%d %H:%M:%S %s: %t");
AutoPtr<FormattingChannel> pFC(new FormattingChannel(pPF, pChannel));
Logger::root().setChannel(pFC);
Logger & logger = Logger::get("TestChannel");
for(int i=0; i<10000; i++){
poco_information(logger, "This is a info");
poco_warning(logger, "This is a warning");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment