Add misc.cpp
This commit is contained in:
parent
79e816e105
commit
381b34f731
|
@ -9,6 +9,7 @@
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "misc.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static FILE* fopen_or_raise(const char* path, const char* mode, bool ignore_enoent) {
|
static FILE* fopen_or_raise(const char* path, const char* mode, bool ignore_enoent) {
|
||||||
|
|
9
log.cpp
9
log.cpp
|
@ -1,9 +1,6 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iomanip>
|
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
|
@ -40,9 +37,3 @@ void log(std::string action, const std::exception& e, time_t time) {
|
||||||
void log(std::string action, const std::exception& e) {
|
void log(std::string action, const std::exception& e) {
|
||||||
log(std::move(action), e, time(nullptr));
|
log(std::move(action), e, time(nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string quote(const std::string& str) {
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << std::quoted(str);
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
|
|
1
log.h
1
log.h
|
@ -10,4 +10,3 @@ void log(std::string entry, time_t time);
|
||||||
void log(std::string entry);
|
void log(std::string entry);
|
||||||
void log(std::string action, const std::exception& e, time_t time);
|
void log(std::string action, const std::exception& e, time_t time);
|
||||||
void log(std::string action, const std::exception& e);
|
void log(std::string action, const std::exception& e);
|
||||||
std::string quote(const std::string& str);
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
std::string quote(const std::string& str) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << std::quoted(str);
|
||||||
|
return ss.str();
|
||||||
|
}
|
Loading…
Reference in New Issue