2016-11-02 18:14:46 +00:00
|
|
|
%% Module to abstract from choice of logger, and allow use of logReferences
|
|
|
|
%% for fast lookup
|
|
|
|
|
|
|
|
-module(leveled_log).
|
|
|
|
|
|
|
|
-include("include/leveled.hrl").
|
|
|
|
|
|
|
|
-include_lib("eunit/include/eunit.hrl").
|
|
|
|
|
|
|
|
-export([log/2,
|
2016-12-22 14:03:31 +00:00
|
|
|
log_timer/3,
|
2017-11-21 23:13:24 +00:00
|
|
|
log_randomtimer/4]).
|
2016-11-02 18:14:46 +00:00
|
|
|
|
|
|
|
-define(LOG_LEVEL, [info, warn, error, critical]).
|
2016-12-22 14:03:31 +00:00
|
|
|
|
2017-05-31 10:56:48 +01:00
|
|
|
-define(LOGBASE, [
|
2016-11-02 18:14:46 +00:00
|
|
|
|
|
|
|
{"G0001",
|
|
|
|
{info, "Generic log point"}},
|
2017-03-06 13:51:38 +00:00
|
|
|
{"G0002",
|
|
|
|
{info, "Generic log point with term ~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"D0001",
|
|
|
|
{debug, "Generic debug log"}},
|
|
|
|
|
|
|
|
{"B0001",
|
|
|
|
{info, "Bookie starting with Ink ~w Pcl ~w"}},
|
|
|
|
{"B0002",
|
|
|
|
{info, "Snapshot starting with Ink ~w Pcl ~w"}},
|
|
|
|
{"B0003",
|
|
|
|
{info, "Bookie closing for reason ~w"}},
|
|
|
|
{"B0004",
|
2017-03-06 10:17:51 +00:00
|
|
|
{info, "Initialised PCL clone and length of increment in snapshot is ~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"B0005",
|
|
|
|
{info, "LedgerSQN=~w at startup"}},
|
|
|
|
{"B0006",
|
|
|
|
{info, "Reached end of load batch with SQN ~w"}},
|
|
|
|
{"B0007",
|
|
|
|
{info, "Skipping as exceeded MaxSQN ~w with SQN ~w"}},
|
2016-11-20 21:21:31 +00:00
|
|
|
{"B0008",
|
|
|
|
{info, "Bucket list finds no more results"}},
|
|
|
|
{"B0009",
|
|
|
|
{info, "Bucket list finds Bucket ~w"}},
|
|
|
|
{"B0010",
|
|
|
|
{info, "Bucket list finds non-binary Bucket ~w"}},
|
2016-11-21 12:34:40 +00:00
|
|
|
{"B0011",
|
|
|
|
{warn, "Call to destroy the store and so all files to be removed"}},
|
2016-12-21 01:56:12 +00:00
|
|
|
{"B0013",
|
|
|
|
{warn, "Long running task took ~w microseconds with task of type ~w"}},
|
2017-11-21 23:13:24 +00:00
|
|
|
{"B0015",
|
|
|
|
{info, "Put timing with sample_count=~w and mem_time=~w ink_time=~w"
|
|
|
|
++ " with total_object_size=~w"}},
|
|
|
|
{"B0016",
|
|
|
|
{info, "Get timing with sample_count=~w and head_time=~w body_time=~w"
|
|
|
|
++ " with fetch_count=~w"}},
|
|
|
|
{"B0017",
|
|
|
|
{info, "Fold timing with sample_count=~w and setup_time=~w"}},
|
2017-12-04 15:26:01 +00:00
|
|
|
{"B0018",
|
|
|
|
{info, "Positive HEAD responses timed with sample_count=~w and "
|
|
|
|
++ " pcl_time=~w rsp_time=~w"}},
|
2017-11-21 23:13:24 +00:00
|
|
|
|
2017-11-21 17:00:23 +00:00
|
|
|
{"R0001",
|
|
|
|
{debug, "Object fold to process batch of ~w objects"}},
|
|
|
|
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0001",
|
2017-03-06 10:17:51 +00:00
|
|
|
{debug, "Ledger snapshot ~w registered"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0003",
|
2017-03-06 10:17:51 +00:00
|
|
|
{debug, "Ledger snapshot ~w released"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0004",
|
2017-03-16 19:37:39 +00:00
|
|
|
{debug, "Remaining ledger snapshots are ~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0005",
|
2017-01-14 20:11:01 +00:00
|
|
|
{info, "Delete confirmed as file ~s is removed from Manifest"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0006",
|
|
|
|
{info, "Orphaned reply after timeout on L0 file write ~s"}},
|
|
|
|
{"P0007",
|
2016-11-04 17:28:04 +00:00
|
|
|
{debug, "Sent release message for cloned Penciller following close for "
|
2016-11-02 18:14:46 +00:00
|
|
|
++ "reason ~w"}},
|
|
|
|
{"P0008",
|
|
|
|
{info, "Penciller closing for reason ~w"}},
|
|
|
|
{"P0010",
|
2016-11-14 17:18:28 +00:00
|
|
|
{info, "No level zero action on close of Penciller ~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0011",
|
|
|
|
{info, "Shutdown complete for Penciller"}},
|
|
|
|
{"P0012",
|
|
|
|
{info, "Store to be started based on manifest sequence number of ~w"}},
|
|
|
|
{"P0013",
|
|
|
|
{warn, "Seqence number of 0 indicates no valid manifest"}},
|
|
|
|
{"P0014",
|
|
|
|
{info, "Maximum sequence number of ~w found in nonzero levels"}},
|
|
|
|
{"P0015",
|
|
|
|
{info, "L0 file found ~s"}},
|
|
|
|
{"P0016",
|
|
|
|
{info, "L0 file had maximum sequence number of ~w"}},
|
|
|
|
{"P0017",
|
|
|
|
{info, "No L0 file found"}},
|
|
|
|
{"P0018",
|
2016-11-18 21:35:45 +00:00
|
|
|
{info, "Response to push_mem of ~w with "
|
|
|
|
++ "L0 pending ~w and merge backlog ~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0019",
|
2016-12-29 02:07:14 +00:00
|
|
|
{info, "Rolling level zero to filename ~s at ledger sqn ~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0021",
|
|
|
|
{info, "Allocation of work blocked as L0 pending"}},
|
|
|
|
{"P0022",
|
|
|
|
{info, "Manifest at Level ~w"}},
|
|
|
|
{"P0023",
|
|
|
|
{info, "Manifest entry of startkey ~s ~s ~s endkey ~s ~s ~s "
|
|
|
|
++ "filename=~s~n"}},
|
|
|
|
{"P0024",
|
2017-01-12 13:48:43 +00:00
|
|
|
{info, "Outstanding compaction work items of ~w with backlog status "
|
|
|
|
++ "of ~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"P0025",
|
|
|
|
{info, "Merge to sqn ~w from Level ~w completed"}},
|
|
|
|
{"P0026",
|
|
|
|
{info, "Merge has been commmitted at sequence number ~w"}},
|
|
|
|
{"P0027",
|
|
|
|
{info, "Rename of manifest from ~s ~w to ~s ~w"}},
|
|
|
|
{"P0028",
|
2016-12-22 17:15:42 +00:00
|
|
|
{debug, "Adding cleared file ~s to deletion list"}},
|
2016-11-05 11:22:27 +00:00
|
|
|
{"P0029",
|
|
|
|
{info, "L0 completion confirmed and will transition to not pending"}},
|
2016-11-21 12:34:40 +00:00
|
|
|
{"P0030",
|
|
|
|
{warn, "We're doomed - intention recorded to destroy all files"}},
|
2016-12-11 05:23:24 +00:00
|
|
|
{"P0031",
|
2017-09-27 23:52:49 +01:00
|
|
|
{info, "Completion of update to levelzero"
|
|
|
|
++ " with cache size status ~w ~w"}},
|
2016-12-22 14:03:31 +00:00
|
|
|
{"P0032",
|
2017-11-21 19:58:36 +00:00
|
|
|
{info, "Fetch head timing with sample_count=~w and level timings of"
|
|
|
|
++ " foundmem_time=~w found0_time=~w found1_time=~w"
|
2018-02-09 08:59:21 +00:00
|
|
|
++ " found2_time=~w found3_time=~w foundlower_time=~w"
|
|
|
|
++ " missed_time=~w"
|
2017-11-21 19:58:36 +00:00
|
|
|
++ " with counts of"
|
|
|
|
++ " foundmem_count=~w found0_count=~w found1_count=~w"
|
2018-02-09 08:59:21 +00:00
|
|
|
++ " found2_count=~w found3_count=~w foundlower_count=~w"
|
|
|
|
++ " missed_count=~w"}},
|
2017-01-09 14:52:26 +00:00
|
|
|
{"P0033",
|
|
|
|
{error, "Corrupted manifest file at path ~s to be ignored "
|
|
|
|
++ "due to error ~w"}},
|
|
|
|
{"P0034",
|
|
|
|
{warn, "Snapshot with pid ~w timed out and so deletion will "
|
|
|
|
++ "continue regardless"}},
|
2017-01-14 22:26:26 +00:00
|
|
|
{"P0035",
|
2017-01-15 11:04:26 +00:00
|
|
|
{info, "Startup with Manifest SQN of ~w"}},
|
|
|
|
{"P0036",
|
2017-03-06 10:17:51 +00:00
|
|
|
{info, "Garbage collection on manifest removes key for filename ~s"}},
|
|
|
|
{"P0037",
|
2017-03-16 20:03:18 +00:00
|
|
|
{debug, "Merging of penciller L0 tree from size ~w complete"}},
|
2017-04-05 09:16:01 +01:00
|
|
|
{"P0038",
|
|
|
|
{info, "Timeout of snapshot with pid=~w at SQN=~w at TS ~w "
|
|
|
|
++ "set to timeout=~w"}},
|
|
|
|
{"P0039",
|
2017-04-19 22:46:37 +01:00
|
|
|
{info, "Failed to release pid=~w "
|
2017-04-05 09:16:01 +01:00
|
|
|
++ "leaving SnapshotCount=~w and MinSQN=~w"}},
|
2017-09-27 23:52:49 +01:00
|
|
|
{"P0040",
|
|
|
|
{info, "Archiving filename ~s as unused at startup"}},
|
2017-10-24 13:19:30 +01:00
|
|
|
{"P0041",
|
|
|
|
{info, "Penciller manifest switched from SQN ~w to ~w"}},
|
2017-01-15 11:04:26 +00:00
|
|
|
|
2016-11-02 18:14:46 +00:00
|
|
|
{"PC001",
|
|
|
|
{info, "Penciller's clerk ~w started with owner ~w"}},
|
|
|
|
{"PC002",
|
|
|
|
{info, "Request for manifest change from clerk on closing"}},
|
|
|
|
{"PC003",
|
|
|
|
{info, "Confirmation of manifest change on closing"}},
|
|
|
|
{"PC004",
|
|
|
|
{info, "Prompted confirmation of manifest change"}},
|
|
|
|
{"PC005",
|
|
|
|
{info, "Penciller's Clerk ~w shutdown now complete for reason ~w"}},
|
|
|
|
{"PC006",
|
2016-12-08 16:43:35 +00:00
|
|
|
{debug, "Work prompted but none needed"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"PC007",
|
|
|
|
{info, "Clerk prompting Penciller regarding manifest change"}},
|
|
|
|
{"PC008",
|
|
|
|
{info, "Merge from level ~w to merge into ~w files below"}},
|
|
|
|
{"PC009",
|
|
|
|
{info, "File ~s to simply switch levels to level ~w"}},
|
|
|
|
{"PC010",
|
|
|
|
{info, "Merge to be commenced for FileToMerge=~s with MSN=~w"}},
|
|
|
|
{"PC011",
|
2017-01-13 18:23:57 +00:00
|
|
|
{info, "Merge completed with MSN=~w to Level=~w and FileCounter=~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"PC012",
|
2017-01-17 10:53:13 +00:00
|
|
|
{info, "File to be created as part of MSN=~w Filename=~s "
|
2017-01-14 21:19:51 +00:00
|
|
|
++ "IsBasement=~w"}},
|
2016-11-02 18:14:46 +00:00
|
|
|
{"PC013",
|
|
|
|
{warn, "Merge resulted in empty file ~s"}},
|
|
|
|
{"PC015",
|
2016-11-03 16:05:43 +00:00
|
|
|
{info, "File created"}},
|
2016-12-21 12:45:27 +00:00
|
|
|
{"PC016",
|
2017-03-13 12:16:36 +00:00
|
|
|
{info, "Slow fetch from SFT ~w of ~w microseconds at level ~w "
|
|
|
|
++ "with result ~w"}},
|
2017-01-15 10:36:50 +00:00
|
|
|
{"PC017",
|
|
|
|
{info, "Notified clerk of manifest change"}},
|
|
|
|
{"PC018",
|
|
|
|
{info, "Saved manifest file"}},
|
2017-01-17 10:32:15 +00:00
|
|
|
{"PC019",
|
2017-01-17 10:53:13 +00:00
|
|
|
{debug, "After ~s level ~w is ~w"}},
|
Resolve pclerk crash
Need to add extra logging to understand why pclerk crashes in some
volume tests.
Penciller's Clerk <0.813.0> shutdown now complete for reason
{badarg,[{dict,fetch,[63,{dict,0,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}],[{file,[100,105,99,116,46,101,114,108]},{line,126}]},{leveled_pclerk,handle_cast,2,[{file,[115,114,99,47,108,101,118,101,108,101,100,95,112,99,108,101,114,107,46,101,114,108]},{line,96}]},{gen_server,handle_msg,5,[{file,[103,101,110,95,115,101,114,118,101,114,46,101,114,108]},{line,604}]},{proc_lib,init_p_do_apply,3,[{file,[112,114,111,99,95,108,105,98,46,101,114,108]},{line,239}]}]}
Should only be prompted after prompt deletions had bene updated.
Perhaps a race whereby somehow it is prompted again after it is emptied.
2017-02-09 14:33:39 +00:00
|
|
|
{"PC020",
|
|
|
|
{warn, "Empty prompt deletions at ManifestSQN=~w"}},
|
|
|
|
{"PC021",
|
|
|
|
{info, "Prompting deletions at ManifestSQN=~w"}},
|
|
|
|
{"PC022",
|
|
|
|
{info, "Storing reference to deletions at ManifestSQN=~w"}},
|
2017-11-21 17:00:23 +00:00
|
|
|
{"PM002",
|
|
|
|
{info, "Completed dump of L0 cache to list of size ~w"}},
|
|
|
|
|
|
|
|
{"SST01",
|
|
|
|
{info, "SST timing for result ~w is sample ~w total ~w and max ~w"}},
|
|
|
|
{"SST02",
|
|
|
|
{error, "False result returned from SST with filename ~s as "
|
|
|
|
++ "slot ~w has failed crc check"}},
|
|
|
|
{"SST03",
|
|
|
|
{info, "Opening SST file with filename ~s slots ~w and"
|
|
|
|
++ " max sqn ~w"}},
|
|
|
|
{"SST04",
|
|
|
|
{info, "Exit called for reason ~w on filename ~s"}},
|
|
|
|
{"SST05",
|
|
|
|
{warn, "Rename rogue filename ~s to ~s"}},
|
|
|
|
{"SST06",
|
|
|
|
{debug, "File ~s has been set for delete"}},
|
|
|
|
{"SST07",
|
|
|
|
{info, "Exit called and now clearing ~s"}},
|
|
|
|
{"SST08",
|
|
|
|
{info, "Completed creation of ~s at level ~w with max sqn ~w"}},
|
|
|
|
{"SST09",
|
|
|
|
{warn, "Read request exposes slot with bad CRC"}},
|
|
|
|
{"SST10",
|
|
|
|
{debug, "Expansion sought to support pointer to pid ~w status ~w"}},
|
|
|
|
{"SST11",
|
|
|
|
{info, "Level zero creation timings in microseconds "
|
|
|
|
++ "pmem_fetch=~w merge_lists=~w build_slots=~w "
|
|
|
|
++ "build_summary=~w read_switch=~w"}},
|
|
|
|
{"SST12",
|
|
|
|
{info, "SST Timings for sample_count=~w"
|
|
|
|
++ " at timing points index_query_time=~w"
|
2017-11-28 14:56:40 +00:00
|
|
|
++ " lookup_cache_time=~w slot_index_time=~w "
|
|
|
|
++ " fetch_cache_time=~w slot_fetch_time=~w"
|
2017-11-21 17:00:23 +00:00
|
|
|
++ " noncached_block_fetch_time=~w"
|
2017-11-28 01:19:30 +00:00
|
|
|
++ " exiting at points slot_index=~w"
|
2017-11-28 14:56:40 +00:00
|
|
|
++ " fetch_cache=~w slot_fetch=~w noncached_block_fetch=~w"}},
|
2017-11-30 16:15:38 +00:00
|
|
|
{"SST13",
|
|
|
|
{info, "SST merge list build timings of"
|
|
|
|
++ " fold_toslot=~w slot_hashlist=~w"
|
|
|
|
++ " slot_serialise=~w slot_finish=~w"
|
|
|
|
++ " is_basement=~w level=~w"}},
|
2017-11-21 17:00:23 +00:00
|
|
|
|
2016-11-03 16:05:43 +00:00
|
|
|
{"I0001",
|
|
|
|
{info, "Unexpected failure to fetch value for Key=~w SQN=~w "
|
|
|
|
++ "with reason ~w"}},
|
|
|
|
{"I0002",
|
|
|
|
{info, "Journal snapshot ~w registered at SQN ~w"}},
|
|
|
|
{"I0003",
|
|
|
|
{info, "Journal snapshot ~w released"}},
|
|
|
|
{"I0004",
|
|
|
|
{info, "Remaining number of journal snapshots is ~w"}},
|
|
|
|
{"I0005",
|
|
|
|
{info, "Inker closing journal for reason ~w"}},
|
|
|
|
{"I0006",
|
|
|
|
{info, "Close triggered with journal_sqn=~w and manifest_sqn=~w"}},
|
|
|
|
{"I0007",
|
|
|
|
{info, "Inker manifest when closing is:"}},
|
|
|
|
{"I0008",
|
|
|
|
{info, "Put to new active journal required roll and manifest write"}},
|
|
|
|
{"I0009",
|
|
|
|
{info, "Updated manifest on startup:"}},
|
|
|
|
{"I0010",
|
|
|
|
{info, "Unchanged manifest on startup:"}},
|
|
|
|
{"I0011",
|
|
|
|
{info, "Manifest is empty, starting from manifest SQN 1"}},
|
|
|
|
{"I0012",
|
|
|
|
{info, "Head manifest entry ~s is complete so new active journal "
|
|
|
|
++ "required"}},
|
|
|
|
{"I0013",
|
|
|
|
{info, "File ~s to be removed from manifest"}},
|
|
|
|
{"I0014",
|
2016-12-11 01:02:56 +00:00
|
|
|
{info, "On startup loading from filename ~s from SQN ~w"}},
|
2016-11-03 16:05:43 +00:00
|
|
|
{"I0015",
|
|
|
|
{info, "Opening manifest file at ~s with SQN ~w"}},
|
|
|
|
{"I0016",
|
|
|
|
{info, "Writing new version of manifest for manifestSQN=~w"}},
|
|
|
|
{"I0017",
|
|
|
|
{info, "At SQN=~w journal has filename ~s"}},
|
2016-11-21 12:34:40 +00:00
|
|
|
{"I0018",
|
|
|
|
{warn, "We're doomed - intention recorded to destroy all files"}},
|
2016-12-20 23:11:50 +00:00
|
|
|
{"I0019",
|
|
|
|
{info, "After ~w PUTs total prepare time is ~w total cdb time is ~w "
|
|
|
|
++ "and max prepare time is ~w and max cdb time is ~w"}},
|
2016-11-03 16:05:43 +00:00
|
|
|
|
|
|
|
{"IC001",
|
2016-11-14 19:34:11 +00:00
|
|
|
{info, "Closed for reason ~w so maybe leaving garbage"}},
|
2016-11-03 16:05:43 +00:00
|
|
|
{"IC002",
|
|
|
|
{info, "Clerk updating Inker as compaction complete of ~w files"}},
|
|
|
|
{"IC003",
|
|
|
|
{info, "No compaction run as highest score=~w"}},
|
|
|
|
{"IC004",
|
|
|
|
{info, "Score for filename ~s is ~w"}},
|
|
|
|
{"IC005",
|
|
|
|
{info, "Compaction to be performed on ~w files with score of ~w"}},
|
|
|
|
{"IC006",
|
|
|
|
{info, "Filename ~s is part of compaction run"}},
|
|
|
|
{"IC007",
|
|
|
|
{info, "Clerk has completed compaction process"}},
|
|
|
|
{"IC008",
|
|
|
|
{info, "Compaction source ~s has yielded ~w positions"}},
|
|
|
|
{"IC009",
|
|
|
|
{info, "Generate journal for compaction with filename ~s"}},
|
2016-11-14 11:17:14 +00:00
|
|
|
{"IC010",
|
|
|
|
{info, "Clearing journal with filename ~s"}},
|
|
|
|
{"IC011",
|
|
|
|
{info, "Not clearing filename ~s as modified delta is only ~w seconds"}},
|
2016-12-16 23:18:55 +00:00
|
|
|
{"IC012",
|
|
|
|
{warn, "Tag ~w not found in Strategy ~w - maybe corrupted"}},
|
|
|
|
{"IC013",
|
|
|
|
{warn, "File with name ~s to be ignored in manifest as scanning for "
|
|
|
|
++ "first key returned empty - maybe corrupted"}},
|
2017-11-21 17:00:23 +00:00
|
|
|
|
2016-11-04 16:11:11 +00:00
|
|
|
{"CDB01",
|
|
|
|
{info, "Opening file for writing with filename ~s"}},
|
|
|
|
{"CDB02",
|
|
|
|
{info, "Opening file for reading with filename ~s"}},
|
|
|
|
{"CDB03",
|
|
|
|
{info, "Re-opening file for reading with filename ~s"}},
|
|
|
|
{"CDB04",
|
|
|
|
{info, "Deletion confirmed for file ~s at ManifestSQN ~w"}},
|
|
|
|
{"CDB05",
|
2017-11-08 12:58:09 +00:00
|
|
|
{info, "Closing of filename ~s from state ~w for reason ~w"}},
|
2016-11-04 16:11:11 +00:00
|
|
|
{"CDB06",
|
|
|
|
{info, "File to be truncated at last position of ~w with end of "
|
|
|
|
++ "file at ~w"}},
|
|
|
|
{"CDB07",
|
|
|
|
{info, "Hashtree computed"}},
|
|
|
|
{"CDB08",
|
|
|
|
{info, "Renaming file from ~s to ~s for which existence is ~w"}},
|
|
|
|
{"CDB09",
|
|
|
|
{info, "Failure to read Key/Value at Position ~w in scan"}},
|
|
|
|
{"CDB10",
|
|
|
|
{info, "CRC check failed due to mismatch"}},
|
|
|
|
{"CDB11",
|
|
|
|
{info, "CRC check failed due to size"}},
|
|
|
|
{"CDB12",
|
2016-11-26 22:59:33 +00:00
|
|
|
{info, "HashTree written"}},
|
|
|
|
{"CDB13",
|
2016-12-13 12:41:44 +00:00
|
|
|
{info, "Write options of ~w"}},
|
|
|
|
{"CDB14",
|
2016-12-13 14:06:19 +00:00
|
|
|
{info, "Microsecond timings for hashtree build of "
|
|
|
|
++ "to_list ~w sort ~w build ~w"}},
|
|
|
|
{"CDB15",
|
2017-11-20 20:01:21 +00:00
|
|
|
{info, "Collision in search for hash ~w"}},
|
2016-12-16 23:18:55 +00:00
|
|
|
{"CDB16",
|
2016-12-20 23:11:50 +00:00
|
|
|
{info, "CDB scan from start ~w in file with end ~w and last_key ~w"}},
|
|
|
|
{"CDB17",
|
|
|
|
{info, "After ~w PUTs total write time is ~w total sync time is ~w "
|
2016-12-22 19:51:39 +00:00
|
|
|
++ "and max write time is ~w and max sync time is ~w"}},
|
|
|
|
{"CDB18",
|
2017-11-20 14:58:43 +00:00
|
|
|
{info, "Handled return and write of hashtable"}},
|
|
|
|
{"CDB19",
|
2017-11-20 15:31:31 +00:00
|
|
|
{info, "Sample timings in microseconds for sample_count=~w "
|
|
|
|
++ "with totals of cycle_count=~w "
|
2017-11-21 17:00:23 +00:00
|
|
|
++ "fetch_time=~w index_time=~w"}}
|
2017-05-31 10:56:48 +01:00
|
|
|
]).
|
2016-11-02 18:14:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
log(LogReference, Subs) ->
|
2017-06-01 22:03:51 +01:00
|
|
|
log(LogReference, Subs, ?LOG_LEVEL).
|
|
|
|
|
|
|
|
log(LogRef, Subs, SupportedLogLevels) ->
|
|
|
|
case lists:keyfind(LogRef, 1, ?LOGBASE) of
|
|
|
|
{LogRef, {LogLevel, LogText}} ->
|
|
|
|
case lists:member(LogLevel, SupportedLogLevels) of
|
|
|
|
true ->
|
|
|
|
io:format(format_time()
|
|
|
|
++ " " ++ LogRef ++ " ~w "
|
|
|
|
++ LogText ++ "~n",
|
|
|
|
[self()|Subs]);
|
|
|
|
false ->
|
|
|
|
ok
|
|
|
|
end;
|
2016-11-02 18:14:46 +00:00
|
|
|
false ->
|
|
|
|
ok
|
|
|
|
end.
|
|
|
|
|
2016-11-04 17:28:04 +00:00
|
|
|
|
2016-11-02 18:14:46 +00:00
|
|
|
log_timer(LogReference, Subs, StartTime) ->
|
2017-06-01 22:03:51 +01:00
|
|
|
log_timer(LogReference, Subs, StartTime, ?LOG_LEVEL).
|
|
|
|
|
|
|
|
log_timer(LogRef, Subs, StartTime, SupportedLogLevels) ->
|
|
|
|
case lists:keyfind(LogRef, 1, ?LOGBASE) of
|
|
|
|
{LogRef, {LogLevel, LogText}} ->
|
|
|
|
case lists:member(LogLevel, SupportedLogLevels) of
|
|
|
|
true ->
|
|
|
|
MicroS = timer:now_diff(os:timestamp(), StartTime),
|
|
|
|
{Unit, Time} = case MicroS of
|
|
|
|
MicroS when MicroS < 1000 ->
|
|
|
|
{"microsec", MicroS};
|
|
|
|
MicroS ->
|
|
|
|
{"ms", MicroS div 1000}
|
|
|
|
end,
|
|
|
|
io:format(format_time()
|
|
|
|
++ " " ++ LogRef ++ " ~w "
|
|
|
|
++ LogText
|
|
|
|
++ " with time taken ~w " ++ Unit ++ "~n",
|
|
|
|
[self()|Subs] ++ [Time]);
|
|
|
|
false ->
|
|
|
|
ok
|
|
|
|
end;
|
2016-11-02 18:14:46 +00:00
|
|
|
false ->
|
|
|
|
ok
|
|
|
|
end.
|
|
|
|
|
2017-03-06 10:34:56 +00:00
|
|
|
log_randomtimer(LogReference, Subs, StartTime, RandomProb) ->
|
2017-07-31 20:20:39 +02:00
|
|
|
R = leveled_rand:uniform(),
|
2017-03-06 13:51:38 +00:00
|
|
|
case R < RandomProb of
|
2017-03-06 10:34:56 +00:00
|
|
|
true ->
|
|
|
|
log_timer(LogReference, Subs, StartTime);
|
|
|
|
false ->
|
|
|
|
ok
|
|
|
|
end.
|
|
|
|
|
2017-01-23 18:56:01 +00:00
|
|
|
format_time() ->
|
|
|
|
format_time(localtime_ms()).
|
|
|
|
|
|
|
|
localtime_ms() ->
|
|
|
|
{_, _, Micro} = Now = os:timestamp(),
|
|
|
|
{Date, {Hours, Minutes, Seconds}} = calendar:now_to_local_time(Now),
|
|
|
|
{Date, {Hours, Minutes, Seconds, Micro div 1000 rem 1000}}.
|
|
|
|
|
|
|
|
format_time({{Y, M, D}, {H, Mi, S, Ms}}) ->
|
|
|
|
io_lib:format("~b-~2..0b-~2..0b", [Y, M, D]) ++ "T" ++
|
|
|
|
io_lib:format("~2..0b:~2..0b:~2..0b.~3..0b", [H, Mi, S, Ms]).
|
2016-12-22 15:45:38 +00:00
|
|
|
|
|
|
|
|
2016-11-02 18:14:46 +00:00
|
|
|
%%%============================================================================
|
|
|
|
%%% Test
|
|
|
|
%%%============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-ifdef(TEST).
|
|
|
|
|
|
|
|
log_test() ->
|
2016-11-04 17:28:04 +00:00
|
|
|
log("D0001", []),
|
|
|
|
log_timer("D0001", [], os:timestamp()).
|
2016-11-02 18:14:46 +00:00
|
|
|
|
2017-06-01 22:03:51 +01:00
|
|
|
log_warn_test() ->
|
|
|
|
ok = log("G0001", [], [warn, error]),
|
|
|
|
ok = log("G8888", [], [info, warn, error]),
|
|
|
|
ok = log_timer("G0001", [], os:timestamp(), [warn, error]),
|
|
|
|
ok = log_timer("G8888", [], os:timestamp(), [info, warn, error]).
|
|
|
|
|
2017-07-31 20:20:39 +02:00
|
|
|
-endif.
|