fluent-logger-mock-sender

Provides a mock sender for fluent logger

License

License

Categories

Categories

Net
GroupId

GroupId

net.moznion
ArtifactId

ArtifactId

fluent-logger-mock-sender
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

fluent-logger-mock-sender
Provides a mock sender for fluent logger
Project URL

Project URL

https://github.com/moznion/fluent-logger-mock-sender
Source Code Management

Source Code Management

https://github.com/moznion/fluent-logger-mock-sender

Download fluent-logger-mock-sender

How to add to project

<!-- https://jarcasting.com/artifacts/net.moznion/fluent-logger-mock-sender/ -->
<dependency>
    <groupId>net.moznion</groupId>
    <artifactId>fluent-logger-mock-sender</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/net.moznion/fluent-logger-mock-sender/
implementation 'net.moznion:fluent-logger-mock-sender:0.0.1'
// https://jarcasting.com/artifacts/net.moznion/fluent-logger-mock-sender/
implementation ("net.moznion:fluent-logger-mock-sender:0.0.1")
'net.moznion:fluent-logger-mock-sender:jar:0.0.1'
<dependency org="net.moznion" name="fluent-logger-mock-sender" rev="0.0.1">
  <artifact name="fluent-logger-mock-sender" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.moznion', module='fluent-logger-mock-sender', version='0.0.1')
)
libraryDependencies += "net.moznion" % "fluent-logger-mock-sender" % "0.0.1"
[net.moznion/fluent-logger-mock-sender "0.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.fluentd : fluent-logger jar 0.3.2

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.14.8

test (2)

Group / Artifact Type Version
junit : junit jar 4.11
com.google.code.findbugs : findbugs jar 3.0.0

Project Modules

There are no modules declared in this project.

fluent-logger-mock-sender

Synopsis

Properties props = System.getProperties();
props.setProperty(Config.FLUENT_SENDER_CLASS, MockSender.class.getName());

FluentLogger logger = FluentLogger.getLogger("tag-prefix");

Map<String, Object> map1 = new HashMap<>();
map1.put("foo", "bar");
Map<String, Object> map2 = new HashMap<>();
map2.put("buz", "qux");

logger.log("app", map1, 1430294276); // Don't send to fluentd. Stack to list
logger.log("db", map2, 1430294277); // Ditto

if (logger.getSender() instanceof MockSender) {
    MockSender sender = (MockSender) logger.getSender();
    sender.getFluentLogs(); // <= Returns List<FluentLog> which is stacked by FluentLogger#log()
    sender.clearFluentLogs(); // <= Clears stacked
}

Description

Provides a mock sender for fluent logger.

This mock doesn't send anything to fluentd, it stacks logs to internal list instead. It means you can pick up a log from list as you like. This mock sender makes easy for testing and debugging.

Author

moznion ([email protected])

License

The MIT License (MIT)
Copyright © 2015 moznion, http://moznion.net/ <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Versions

Version
0.0.1