salsa 0.7.1
Loading...
Searching...
No Matches
Log.hh
1#pragma once
2#include <memory>
3#include <string>
4#include <vector>
5// #include <spdlog/sinks/basic_file_sink.h>
6// #include <spdlog/sinks/stdout_sinks.h>
7#include "salsa.hh"
8
9namespace Salsa {
18
19class Log {
20public:
21 Log();
22 ~Log();
23
25 int add(std::string);
27 void name(char const * pNewName) { mName = pNewName; }
29 void name(std::string newName) { mName = newName; }
30
32 std::string name() const { return mName; }
33
35 int create();
37 int write(char const *);
39 std::shared_ptr<spdlog::logger> spd() { return mpTarget; }
41 int empty() { return mSinks.empty(); }
42
44 void fd(int newFD) { mFD = newFD; }
46 int fd() const { return mFD; }
47
48private:
49 int mFD = -1;
50 static uint64_t msID;
51 std::string mName = nullptr;
52 std::vector<spdlog::sink_ptr> mSinks;
53 std::shared_ptr<spdlog::logger> mpTarget = nullptr;
54};
55} // namespace Salsa
std::string name() const
Get name of job (only used for spdlog logger identification)
Definition Log.hh:32
void name(std::string newName)
Set name of job (only used for spdlog logger identification)
Definition Log.hh:29
static uint64_t msID
Static Job newName (holds index)
Definition Log.hh:50
std::shared_ptr< spdlog::logger > spd()
Get SPDLOG logger handle.
Definition Log.hh:39
int write(char const *)
Write to logger.
Definition Log.cc:64
int add(std::string)
Add output sink (file, console, zmq) for SPDLOG.
Definition Log.cc:12
int mFD
FD of current pipe.
Definition Log.hh:49
void name(char const *pNewName)
Set name of job (only used for spdlog logger identification)
Definition Log.hh:27
int fd() const
Get FD of currently watched pipe.
Definition Log.hh:46
void fd(int newFD)
Set FD of pipe to watch.
Definition Log.hh:44
std::shared_ptr< spdlog::logger > mpTarget
SPDLOG logger handle.
Definition Log.hh:53
std::string mName
newName (name) of current job
Definition Log.hh:51
int create()
Create SPDLOG loger.
Definition Log.cc:45
int empty()
Get info about sinks.
Definition Log.hh:41
std::vector< spdlog::sink_ptr > mSinks
Sinks for SPDLOG.
Definition Log.hh:52