Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added META.json and README.pod

  • Loading branch information...
commit 15fb78564c082f2362b4207793c83777d86dda41 1 parent 7e42e34
Eric Johnson authored
Showing with 158 additions and 0 deletions.
  1. +78 −0 META.json
  2. +80 −0 README.pod
78 META.json
View
@@ -0,0 +1,78 @@
+{
+ "abstract" : "Log data to a file as JSON",
+ "author" : [
+ "Eric Johnson <cpan at iijo dot org>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 4.300000, CPAN::Meta::Converter version 2.112150",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Log-JSON",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "xt",
+ "examples",
+ "corpus"
+ ],
+ "package" : [
+ "DB"
+ ]
+ },
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "6.30"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Carp" : 0,
+ "DateTime" : 0,
+ "English" : 0,
+ "JSON" : 0,
+ "Moose" : 0,
+ "MooseX::Types::Path::Class" : 0,
+ "Path::Class::File" : 0,
+ "perl" : "5.006"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Directory::Scratch" : 0,
+ "File::Find" : 0,
+ "File::Slurp" : 0,
+ "File::Temp" : 0,
+ "Test::More" : 0,
+ "Test::Most" : 0,
+ "strict" : 0,
+ "warnings" : 0
+ }
+ }
+ },
+ "provides" : {
+ "Log::JSON" : {
+ "file" : "lib/Log/JSON.pm",
+ "version" : "0.001"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "web" : "https://github.com/kablamo/Log-JSON/issues"
+ },
+ "homepage" : "https://github.com/kablamo/Log-JSON",
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/kablamo/Log-JSON.git",
+ "web" : "https://github.com/kablamo/Log-JSON"
+ }
+ },
+ "version" : "0.001"
+}
+
80 README.pod
View
@@ -0,0 +1,80 @@
+=encoding utf-8
+
+=head1 NAME
+
+Log::JSON - Log data to a file as JSON
+
+=head1 SYNOPSIS
+
+ use Log::JSON;
+ my $logger = Log::JSON->new(
+ file => '/path/errorlog.json', # required
+ date => 1, # optional
+ remove_newlines => 1, # optional
+ );
+ $logger->log(a => 1, b => 2);
+ # '/path/errorlog.json' now contains:
+ # {"__date":"2010-03-28T23:15:52Z","a":1,"b":1}
+
+=head1 DESCRIPTION
+
+This module logs a hash to a file as JSON. The keys are printed in sorted order.
+
+Often log files have several raw numbers and strings whose meaning is not
+immediately clear. With JSON formatted text in your log files, a human can
+open the file and quickly decipher the content because each piece of
+information is labeled.
+
+Using JSON also means log files are easy to parse and the data structures can
+be easily revived.
+
+=head1 ATTRIBUTES
+
+=head2 file
+
+The name of the file to log data to
+
+=head2 date
+
+Adds an __date field to your json. The '__' part ensures the date is the first
+information logged to each line when the keys are sorted.
+
+=head2 remove_newlines
+
+This boolean is set to true by default. It means your jason data structures
+will be logged entirely on one line.
+
+=head1 METHODS
+
+=head2 new(%attributes)
+
+Returns a Log::JSON object.
+
+=head2 log(%hash)
+
+Appends %hash to a file as JSON. The keys are sorted when the hash is converted to JSON.
+
+=head1 BUGS
+
+This should probably should have been a Log::Dispatch plugin.
+
+=head1 THANKS
+
+Thanks to Foxtons Ltd for providing the opportunity to write and release the
+original version of this module.
+
+=head1 SEE ALSO
+
+L<Log::Message::Structured>, L<Log::Structured>, L<Log::Sprintf>
+
+=head1 AUTHOR
+
+Eric Johnson <cpan at iijo dot org>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2012 by Eric Johnson.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
Please sign in to comment.
Something went wrong with that request. Please try again.