<commit_before>// messagespy.h - A helper entity for message monitoring
//
// This is the declaration of a monitoring class for
// internal message monitoring. The messages are
// emitted through the serial interface
// The class works only if #define DEBUG

#pragma once

// dependencies
#include "../core/entity.h"

namespace meisterwerk {
    namespace util {

        class messagespy : public meisterwerk::core::entity {
            private:
#ifdef _DEBUG
            String tmpSubscribedTopic;
#endif

            public:
#ifdef _DEBUG
            messagespy( String name = "spy", String subscription = "*" )
                : meisterwerk::core::entity( name ) {
                tmpSubscribedTopic = subscription;
            }

            void onRegister() override {
                subscribe( tmpSubscribedTopic );
                tmpSubscribedTopic = "";
            }

            virtual void onReceive( String origin, String topic, String msg ) override {
                Serial.println( "messagespy(" + entName + "): origin='" + origin + "' topic='" +
                                topic + "' body='" + msg + "'" );
            }
#else
            messagespy( String name = "", String subscription = "" )
                : meisterwerk::core::entity( "" ) {
            }

            bool registerEntity( unsigned long minMicroSecs = 0, unsigned int priority = 3 ) {
                // never register but fake success
                return true;
            }
#endif
        };
    } // namespace util<commit_msg>duplication of millis() timestamp change for messagespy in this branch<commit_after>// messagespy.h - A helper entity for message monitoring
//
// This is the declaration of a monitoring class for
// internal message monitoring. The messages are
// emitted through the serial interface
// The class works only if #define DEBUG

#pragma once

// dependencies
#include "../core/entity.h"

namespace meisterwerk {
    namespace util {

        class messagespy : public meisterwerk::core::entity {
            private:
#ifdef _DEBUG
            String tmpSubscribedTopic;
#endif

            public:
#ifdef _DEBUG
            messagespy( String name = "spy", String subscription = "*" )
                : meisterwerk::core::entity( name ) {
                tmpSubscribedTopic = subscription;
            }

            void onRegister() override {
                subscribe( tmpSubscribedTopic );
                tmpSubscribedTopic = "";
            }

            virtual void onReceive( String origin, String topic, String msg ) override {
                String tmillis = String( millis() );
                while ( tmillis.length() < 10 )
                    tmillis = "0" + tmillis;
                Serial.println( tmillis + ":" + entName + ": origin='" + origin + "' topic='" +
                                topic + "' body='" + msg + "'" );
            }
#else
            messagespy( String name = "", String subscription = "" )
                : meisterwerk::core::entity( "" ) {
            }

            bool registerEntity( unsigned long minMicroSecs = 0, unsigned int priority = 3 ) {
                // never register but fake success
                return true;
            }
#endif
        };
    } // namespace util
{'fraction_non_alphanumeric': 0.09957107843137254, 'fraction_numerical': 0.002144607843137255, 'mean_word_length': 1.7483164983164983, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2050177', 'n_tokens_mistral': 806, 'n_tokens_neox': 768, 'n_words': 256}