Skip to content

Commit 3ac388e

Browse files
committed
✨ Make more generic the display function of log, now it can be override !
1 parent 641de74 commit 3ac388e

File tree

11 files changed

+168
-136
lines changed

11 files changed

+168
-136
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
-1.5 KB
Binary file not shown.
-39 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
18.5 KB
Binary file not shown.
1.68 KB
Binary file not shown.
2.85 KB
Binary file not shown.

Plugin/Utilities/include/log.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#pragma once
22
#include "framework.h"
33
#include <fstream>
4-
#include <string>
54
#include <vector>
5+
#include <functional>
6+
#include <string>
7+
#include <iostream>
68

79
extern "C"
810
{
@@ -34,6 +36,9 @@ extern "C"
3436
std::vector<std::string> _logWarningVector;
3537
std::vector<std::string> _logErrorVector;
3638
std::string _logBufferSum;
39+
std::function<void(std::string, std::fstream&)> _infoPrintFunction;
40+
std::function<void(std::string, std::fstream&)> _warningPrintFunction;
41+
std::function<void(std::string, std::fstream&)> _errorPrintFunction;
3742

3843
public:
3944
// SINGLETON
@@ -48,6 +53,26 @@ extern "C"
4853
Log();
4954
~Log();
5055

56+
/// <summary>
57+
/// This function is called when debulLog is called, it will write the string in parameters
58+
/// and the fstream is the log file
59+
/// </summary>
60+
void setInfoPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
61+
62+
63+
/// <summary>
64+
/// This function is called when debulLogWarning is called, it will write the string in parameters
65+
/// and the fstream is the log file
66+
/// </summary>
67+
void setWarningPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
68+
69+
70+
/// <summary>
71+
/// This function is called when debulLogError is called, it will write the string in parameters
72+
/// and the fstream is the log file
73+
/// </summary>
74+
void setErrorPrintFunction(std::function<void(std::string, std::fstream&)> printFunc);
75+
5176
/// <summary>
5277
/// It will merge all log and separate them by '\n'
5378
/// </summary>

0 commit comments

Comments
 (0)