Need a simple logger in Win32 ?

If you need like me, a logger for your deamons and services… just look at this simple logger:

#pragma once
#include <string>

class CLogger
	virtual ~CLogger();

	void Init(std::wstring name);
	void WriteLog(std::wstring message);

	std::wstring _name;
	std::wstring _path;

You put the name of the file in Init() method as then, you just call WriteLog() ! Let’s ook at the code impl:

#include "stdafx.h"
#include "Logger.h"



void CLogger::Init(std::wstring name)
	_name = name;

	TCHAR szTemp[255];
	_stprintf_s(szTemp, _T("C:\\TEMP\\LOGS"));
	::CreateDirectory(szTemp, NULL);

	TCHAR szPath[255];
	_stprintf_s(szPath, _T("%s\\%s"), szTemp, name.c_str());

	_path = szPath;

void CLogger::WriteLog(std::wstring message)
	std::string path(_path.begin(), _path.end());

	memset(&st, 0, sizeof(SYSTEMTIME));

	TCHAR sz[1024];
		_T("%02d:%02d:%02d.%03d - INFO - %s\r\n"), 
		st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, 

	std::wstring wsz = sz;
	std::string msgToWrite(wsz.begin(), wsz.end());

	HANDLE hFile = ::CreateFileA(path.c_str(), 

	LONG l = 0;
	::SetFilePointer(hFile, 0, &l, FILE_END);
	DWORD dwLen = 0;
		msgToWrite.c_str(), msgToWrite.length(), 
		&dwLen, NULL);




Programming IoT with Azure and MXCHIP device

I recently have done a 2 days event in MS Office about programming MXCHIP and Azure IoT stuff. It’s amazing what that kind of little hardware can achieve. For now, I have to make a demo for my managers.

The code and compilers are included into VSCode extensions and SDK Kit.

Everything is simple in the demo mode. But in real, you spend a lot of time… :)

Microsoft is buying GitHub

The open-source community are not very happy. In my opinion, it’s the same thing that when Oracle buy Java and MySQL… You think of something just foolish. The problem is that Microsoft tell us that the company has changed and they do Open-Source.

First, we don’t have all the same definitions of what is Open-Source development. Microsoft vision is not Richard Stallman vision.

Some people tell us that a lot of companies/people will leave Github. True or False ?

Let’s take time to see and we will comment in 6 months.

Coding Live at DevCon6 for Programmez Magazine

Monday 25 June 2018, I will be a speaker for a Programmez magazine event.

I will code C live ! It will be about coding LMDB for Windows as a DLL and testing a client that can make 1.000.000 rows in 1 second. Can you say that ?

Make OpenLDAP-LMDB OSS project a DLL

Source code from To make a DLL, it’s just some syntax errors compilation in MSVC 17. But if builds after minor corrections.

My new war room

This week has been a busy week. I have changed from an appartment to another from Nogent sur Marne to Fontenay sous Bois. Putting all the little things in bags… It’s done. I am tired.

Look my desktop, it’s cool:

.NET Rangers

I am proud to announce that the .NET Rangers community is back ! We have 3 MVP !

We have a blog : and a Twitter account:

.NET Rangers @RangersNet

Members of the community:

  • Jean-Baptiste B. Sogeti
  • Cdric G. Sogeti
  • Jean-Nicolas B. Sogeti
  • Guilhem M. C-S
  • Cdric T. Sogeti
  • Keelan C. Sogeti
  • Eva D. Neos-SDI
  • Frederic S. Sydev
  • Michel F. Indep
  • Jean-Nol G. Indep
  • Christophe P. Neos-SDI