WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
EventLogger.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (c) ATTX INC 2025. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX INC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX INC.
15******************************************************************************/
16/*
17Event Logger header file
18
19Author: Alex Reynolds
20*/
21#ifndef CONFIGURATION_EVENT_LOGGER_H
22#define CONFIGURATION_EVENT_LOGGER_H
23
24#include <stdio.h>
25#include <stdlib.h>
26#include <string>
27
29#include "flight/flighterrors.h"
30
31namespace warptwin {
32
34 const unsigned int DEFAULT_MAX_MSG = 280;
35
51 public:
55 EventLogger(FILE *fp=stdout, unsigned int max_size=DEFAULT_MAX_MSG) :
56 _fp(fp), _log_level(LOG_INFO), _max_message_size(max_size), _msg(DEFAULT_MAX_MSG, '\0') {};
57
60 void logLevel(log_level_e level) {_log_level = level;}
61
64 log_level_e logLevel() {return _log_level;}
65
72 int logMessage(log_level_e level, const std::string &message, log_level_e local_msg=LOG_NONE);
73
77 int flushLogs();
78 private:
80 FILE *_fp;
81
83 log_level_e _log_level;
84
86 unsigned int _max_message_size;
87
89 std::string _msg;
90 };
91
92}
93
94#endif
log_level_e logLevel()
Function to get log level for system.
Definition EventLogger.h:64
int flushLogs()
Function to flush the file buffer.
Definition EventLogger.cpp:46
EventLogger(FILE *fp=stdout, unsigned int max_size=DEFAULT_MAX_MSG)
Simple constructor for event logger.
Definition EventLogger.h:55
int logMessage(log_level_e level, const std::string &message, log_level_e local_msg=LOG_NONE)
Function to write an event message.
Definition EventLogger.cpp:20
void logLevel(log_level_e level)
Function to set logging level for system.
Definition EventLogger.h:60
log_level_e
Log level enumerations.
Definition flighterrors.h:159
@ LOG_INFO
Definition flighterrors.h:163
@ LOG_NONE
Definition flighterrors.h:160
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
const unsigned int DEFAULT_MAX_MSG
Define some standard messages for writing to file.
Definition EventLogger.h:34